nix-config/flake/nixos.nix

44 lines
1,007 B
Nix
Raw Normal View History

2023-12-07 22:33:10 +01:00
{ self, config, inputs, lib, ... }:
let
defaultModules = [
{
# Let 'nixos-version --json' know about the Git revision
system.configurationRevision = self.rev or "dirty";
}
{
nixpkgs.overlays = (lib.attrValues self.overlays) ++ [
2023-03-08 18:53:21 +01:00
inputs.nur.overlay
];
}
# Include generic settings
"${self}/modules/nixos"
2024-01-03 17:50:22 +01:00
# Import common modules
"${self}/modules/common"
];
buildHost = name: system: lib.nixosSystem {
inherit system;
modules = defaultModules ++ [
"${self}/hosts/nixos/${name}"
];
specialArgs = {
# Use my extended lib in NixOS configuration
inherit (self) lib;
# Inject inputs to use them in global registry
inherit inputs;
2024-01-03 17:50:22 +01:00
# For consumption by common modules
type = "nixos";
};
};
in
2023-03-08 18:53:21 +01:00
{
2023-12-07 22:33:10 +01:00
config = {
hosts.nixos = {
aramis = "x86_64-linux";
porthos = "x86_64-linux";
};
flake.nixosConfigurations = lib.mapAttrs buildHost config.hosts.nixos;
2023-03-08 18:53:21 +01:00
};
}