rice/flake.nix

86 lines
2.2 KiB
Nix

{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nur.url = "github:nix-community/NUR";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
agenix = {
url = "github:ryantm/agenix";
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
};
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
website = {
url = "github:buffet/website";
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;
};
});
}