refactor
This commit is contained in:
parent
0b97b828be
commit
f185ce3c92
3 changed files with 96 additions and 43 deletions
43
flake.nix
43
flake.nix
|
|
@ -33,38 +33,33 @@
|
|||
stylix,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (self) outputs;
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
defaultConf = rec {
|
||||
uid = 1000;
|
||||
user = "lilith";
|
||||
home = /home/${user};
|
||||
|
||||
tmpfsSize = "4G";
|
||||
|
||||
extraConfig = {};
|
||||
};
|
||||
|
||||
hosts = builtins.filter (host: builtins.pathExists ./hosts/${host}/configuration.nix) (builtins.attrNames (builtins.readDir ./hosts));
|
||||
|
||||
mkHostConfig = host: let
|
||||
defaultConf = rec {
|
||||
hostname = host;
|
||||
importHostConf = host:
|
||||
lib.recursiveUpdate defaultConf (import ./hosts/${host} inputs
|
||||
// {
|
||||
hostname = host;
|
||||
hardware-configuration = ./hosts/${host}/hardware-configuration.nix;
|
||||
});
|
||||
|
||||
uid = 1000;
|
||||
user = "lilith";
|
||||
home = /home/${user};
|
||||
};
|
||||
in
|
||||
nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit inputs outputs;
|
||||
conf = defaultConf;
|
||||
};
|
||||
modules = [
|
||||
./hosts/${host}/configuration.nix
|
||||
./hosts/${host}/hardware-configuration.nix
|
||||
impermanence.nixosModule
|
||||
home-manager.nixosModule
|
||||
sops-nix.nixosModules.sops
|
||||
stylix.nixosModules.stylix
|
||||
];
|
||||
};
|
||||
mkHostConfig = host: import ./system (inputs // {conf = importHostConf host;});
|
||||
in {
|
||||
nixosConfigurations = builtins.listToAttrs (
|
||||
map (host: {
|
||||
name = host;
|
||||
value = mkHostConfig host;
|
||||
value = (mkHostConfig host).build;
|
||||
})
|
||||
hosts
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue