rice/flake.nix

118 lines
2.9 KiB
Nix

{
nixConfig = {
commit-lockfile-summary = "build(flake): update inputs";
extra-substituters = [
"https://cache.lix.systems"
];
extra-trusted-public-keys = [
"cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
];
};
inputs = {
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nur.url = "github:nix-community/NUR";
agenix = {
url = "github:ryantm/agenix";
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0-rc1.tar.gz";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs = {
nixpkgs.follows = "nixpkgs-unstable";
nixpkgs-stable.follows = "nixpkgs";
};
};
systems = {
url = "github:nix-systems/default";
flake = false;
};
};
outputs = {
self,
flake-utils,
nixpkgs,
nixpkgs-unstable,
pre-commit-hooks,
...
} @ args: let
makeSystem = system: config:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = args;
modules = let
overlay-unstable = final: prev: {
unstable = nixpkgs-unstable.legacyPackages.${prev.system};
};
in [
config
(_: {nixpkgs.overlays = [(import ./overlay args) overlay-unstable];})
];
};
in
{
nixosConfigurations = {
ami = makeSystem "aarch64-linux" ./hosts/ami;
alice = makeSystem "x86_64-linux" ./hosts/alice;
};
}
// flake-utils.lib.eachDefaultSystem (system: {
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
statix = {
enable = true;
settings.ignore = ["/.direnv"];
};
};
};
};
devShell = nixpkgs.legacyPackages.${system}.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
};
});
}