alqueva/lib/default.nix

58 lines
1.4 KiB
Nix
Raw Normal View History

{
inputs,
self,
...
}: {
flake.lib = let
inherit (inputs.nixpkgs.lib) nixosSystem;
inherit (builtins) mapAttrs;
mkHost = {
hostname,
system,
extraModules ? [],
extraSpecialArgs ? {},
}:
nixosSystem {
inherit system;
specialArgs = {inherit inputs self;} // extraSpecialArgs;
modules =
[
../hosts/${hostname}
self.nixosModules.default
{
_module.args = {
lib' = self.lib;
inherit system;
};
nixpkgs = {
inherit system;
config.allowUnfree = true;
};
}
{
networking.hostName = hostname;
nix = {
settings.extra-experimental-features = [
"nix-command"
"flakes"
];
gc = {
automatic = true;
dates = "weekly";
};
2024-10-16 00:03:53 +01:00
};
systemd.oomd = {
enableRootSlice = true;
extraConfig = {DefaultMemoryPressureDurationSec = "20s";};
};
}
]
++ extraModules;
2024-10-16 00:03:53 +01:00
};
mkHosts = mapAttrs (hostname: args: mkHost (args // {inherit hostname;}));
in {
inherit mkHosts;
};
2024-10-16 00:03:53 +01:00
}