config: fix and improve upon importNodes

This commit is contained in:
Gabriel Arazas 2022-12-01 08:21:04 +08:00
parent 9a0079a7fc
commit acfc617e10

View File

@ -449,20 +449,21 @@
# ignoring the shell entry by simply prefixing it with a space which most # ignoring the shell entry by simply prefixing it with a space which most
# command-line shells have support for (e.g., Bash, zsh, fish). # command-line shells have support for (e.g., Bash, zsh, fish).
deploy.nodes = let deploy.nodes = let
importNodes = prefix: systems: importNodes = { prefix, activation ? prefix, environments, system ? defaultSystem }:
lib'.mapAttrs' lib'.mapAttrs'
(name: value: (name: value:
lib'.nameValuePair "${prefix}-name" { lib'.nameValuePair "${prefix}-${name}" {
hostname = name; hostname = name;
profiles.system = { profiles.system = {
sshUser = "admin"; sshUser = "admin";
user = "root"; user = "root";
path = inputs.deploy.lib.${defaultSystem}.activate.nixos value; path = inputs.deploy.lib.${defaultSystem}.activate."${activation}" value;
remoteBuild = true;
}; };
}) })
systems; environments;
in (importNodes "nixos" self.nixosConfigurations) in (importNodes { prefix = "nixos"; environments = self.nixosConfigurations; })
// (importNodes "home-manager" self.homeManagerConfigurations); // (importNodes { prefix = "home-manager"; environments = self.homeManagerConfigurations; });
# How to make yourself slightly saner than before. So far the main checks # How to make yourself slightly saner than before. So far the main checks
# are for deploy nodes. # are for deploy nodes.