rice/flake.nix
2024-08-19 16:50:04 +02:00

139 lines
3.4 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 = {
flake-compat.url = "github:edolstra/flake-compat";
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";
};
};
devshell = {
url = "github:numtide/devshell";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
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.91.0.tar.gz";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim/nixos-24.05";
inputs = {
devshell.follows = "devshell";
flake-compat.follows = "flake-compat";
git-hooks.follows = "git-hooks";
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
};
};
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs = {
flake-compat.follows = "flake-compat";
nixpkgs.follows = "nixpkgs-unstable";
nixpkgs-stable.follows = "nixpkgs";
};
};
systems = {
url = "github:nix-systems/default";
flake = false;
};
};
outputs = {
self,
flake-utils,
nixpkgs,
nixpkgs-unstable,
git-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 = git-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
statix = {
enable = true;
settings.ignore = ["/.direnv"];
};
};
};
};
devShells.default = nixpkgs.legacyPackages.${system}.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
};
});
}