chore: make dynamic import usage clearer

This commit is contained in:
Leon Schwarzäugl 2025-02-26 00:42:24 +01:00
parent b54d3ee065
commit b67abcce27
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
2 changed files with 66 additions and 60 deletions

View file

@ -4419,43 +4419,46 @@ TODO
systemFunc { systemFunc {
specialArgs = { inherit inputs outputs lib self; }; specialArgs = { inherit inputs outputs lib self; };
modules = [ modules = [
# put inports here that are for all hosts
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
inputs.lanzaboote.nixosModules.lanzaboote inputs.lanzaboote.nixosModules.lanzaboote
"${self}/hosts/${type}/${host}" "${self}/hosts/${type}/${host}"
] ++ ] ++
# toto (deployment sandbox) & iso should never receive general configuration
(if (host == "toto" || host == "iso") then [ ] else (if (host == "toto" || host == "iso") then [ ] else
( ([
# sync & winters (servers) should not receive common non-server config # put inports here that are for all servers and normal hosts
(if (host == "winters" || host == "sync") then [ ] else [ inputs.nix-topology.nixosModules.default
"${self}/profiles/${type}/common" ] ++
inputs.stylix.nixosModules.stylix (if (host == "winters" || host == "sync") then [ ] else [
inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm # put imports here that are for all normal hosts
inputs.nix-topology.nixosModules.default "${self}/profiles/${type}/common"
]) ++ (if (type == "nixos") then [ inputs.stylix.nixosModules.stylix
inputs.home-manager.nixosModules.home-manager inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm
{ ]) ++ (if (type == "nixos") then [
home-manager.users.swarsel.imports = ( inputs.home-manager.nixosModules.home-manager
# sync & winters (servers) should not receive common non-server config {
if (host == "winters" || host == "sync") then [ ] else [ home-manager.users.swarsel.imports = (
"${self}/profiles/home/common" if (host == "winters" || host == "sync") then [ ] else [
] # put imports here that are for all normal hosts
) ++ [ "${self}/profiles/home/common"
inputs.sops-nix.homeManagerModules.sops ]
inputs.nix-index-database.hmModules.nix-index ) ++ [
] ++ (builtins.attrValues outputs.homeModules); # put inports here that are for all servers and normal hosts
} inputs.sops-nix.homeManagerModules.sops
] else [ inputs.nix-index-database.hmModules.nix-index
"${self}/profiles/darwin/nixos/common" ] ++ (builtins.attrValues outputs.homeModules);
inputs.home-manager.darwinModules.home-manager }
{ ] else [
home-manager.users."leon.schwarzaeugl".imports = [ "${self}/profiles/darwin/nixos/common"
"${self}/profiles/darwin/home" inputs.home-manager.darwinModules.home-manager
] ++ (builtins.attrValues outputs.homeModules); {
} home-manager.users."leon.schwarzaeugl".imports = [
]) ++ (builtins.attrValues outputs.nixosModules) ++ (builtins.attrValues outputs.homeModules) "${self}/profiles/darwin/home"
] ++ (builtins.attrValues outputs.homeModules);
}
]) ++ (builtins.attrValues outputs.nixosModules) ++ (builtins.attrValues outputs.homeModules)
)); ));
}; };
}; };

View file

@ -32,43 +32,46 @@
systemFunc { systemFunc {
specialArgs = { inherit inputs outputs lib self; }; specialArgs = { inherit inputs outputs lib self; };
modules = [ modules = [
# put inports here that are for all hosts
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
inputs.lanzaboote.nixosModules.lanzaboote inputs.lanzaboote.nixosModules.lanzaboote
"${self}/hosts/${type}/${host}" "${self}/hosts/${type}/${host}"
] ++ ] ++
# toto (deployment sandbox) & iso should never receive general configuration
(if (host == "toto" || host == "iso") then [ ] else (if (host == "toto" || host == "iso") then [ ] else
( ([
# sync & winters (servers) should not receive common non-server config # put inports here that are for all servers and normal hosts
(if (host == "winters" || host == "sync") then [ ] else [ inputs.nix-topology.nixosModules.default
"${self}/profiles/${type}/common" ] ++
inputs.stylix.nixosModules.stylix (if (host == "winters" || host == "sync") then [ ] else [
inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm # put imports here that are for all normal hosts
inputs.nix-topology.nixosModules.default "${self}/profiles/${type}/common"
]) ++ (if (type == "nixos") then [ inputs.stylix.nixosModules.stylix
inputs.home-manager.nixosModules.home-manager inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm
{ ]) ++ (if (type == "nixos") then [
home-manager.users.swarsel.imports = ( inputs.home-manager.nixosModules.home-manager
# sync & winters (servers) should not receive common non-server config {
if (host == "winters" || host == "sync") then [ ] else [ home-manager.users.swarsel.imports = (
"${self}/profiles/home/common" if (host == "winters" || host == "sync") then [ ] else [
] # put imports here that are for all normal hosts
) ++ [ "${self}/profiles/home/common"
inputs.sops-nix.homeManagerModules.sops ]
inputs.nix-index-database.hmModules.nix-index ) ++ [
] ++ (builtins.attrValues outputs.homeModules); # put inports here that are for all servers and normal hosts
} inputs.sops-nix.homeManagerModules.sops
] else [ inputs.nix-index-database.hmModules.nix-index
"${self}/profiles/darwin/nixos/common" ] ++ (builtins.attrValues outputs.homeModules);
inputs.home-manager.darwinModules.home-manager }
{ ] else [
home-manager.users."leon.schwarzaeugl".imports = [ "${self}/profiles/darwin/nixos/common"
"${self}/profiles/darwin/home" inputs.home-manager.darwinModules.home-manager
] ++ (builtins.attrValues outputs.homeModules); {
} home-manager.users."leon.schwarzaeugl".imports = [
]) ++ (builtins.attrValues outputs.nixosModules) ++ (builtins.attrValues outputs.homeModules) "${self}/profiles/darwin/home"
] ++ (builtins.attrValues outputs.homeModules);
}
]) ++ (builtins.attrValues outputs.nixosModules) ++ (builtins.attrValues outputs.homeModules)
)); ));
}; };
}; };