nix-config/modules/nixos-configurations.nix
2025-11-19 18:09:57 +00:00

60 lines
1.2 KiB
Nix

{
config,
inputs,
self,
...
}:
{
flake =
let
inherit (self) outputs;
specialArgs = {
inherit inputs outputs self;
system = "x86_64-linux";
username = "opdavies";
};
mkHost =
{
hostname,
modules ? [ ],
stateVersion ? "22.11",
system ? "x86_64-linux",
}:
inputs.nixpkgs.lib.nixosSystem {
inherit system;
modules =
modules
++ (
# TODO: remove once everything has bee moved to modules.
if builtins.pathExists "${self}/hosts/${hostname}/configuration.nix" then
"${self}/hosts/${hostname}/configuration.nix"
else
[ ]
)
++ [
(config.flake.modules.nixos."nixosConfigurations/${hostname}" or { })
];
specialArgs = specialArgs // {
inherit hostname stateVersion system;
};
};
in
{
nixosConfigurations = {
nixedo = mkHost {
hostname = "nixedo";
stateVersion = "24.11";
};
t480 = mkHost {
hostname = "t480";
};
};
};
}