config: fix deploy function with correct system

Also added some more configuration options for home-manager deploy
options.
This commit is contained in:
Gabriel Arazas 2023-07-01 12:30:36 +08:00
parent 3cc199cf15
commit ef0d3d92cd
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -413,10 +413,6 @@
# nixops-lite (that is much more powerful than nixops itself)... in # nixops-lite (that is much more powerful than nixops itself)... in
# here!?! We got it all, son! # here!?! We got it all, son!
# #
# Take note for automatically imported nodes, various options should be
# overridden in the deploy utility considering that most have only
# certain values and likely not work if run with the intended value.
#
# Also, don't forget to always clean your shell history when overriding # Also, don't forget to always clean your shell history when overriding
# sensitive info such as the hostname and such. A helpful tip would be # sensitive info such as the hostname and such. A helpful tip would be
# 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
@ -425,7 +421,9 @@
let let
nixosConfigurations = lib'.mapAttrs' nixosConfigurations = lib'.mapAttrs'
(name: value: (name: value:
let metadata = images.${name}; in let
metadata = images.${name};
in
lib'.nameValuePair "nixos-${name}" { lib'.nameValuePair "nixos-${name}" {
hostname = metadata.deploy.hostname or name; hostname = metadata.deploy.hostname or name;
autoRollback = metadata.deploy.auto-rollback or true; autoRollback = metadata.deploy.auto-rollback or true;
@ -433,22 +431,30 @@
fastConnection = metadata.deploy.fast-connection or true; fastConnection = metadata.deploy.fast-connection or true;
remoteBuild = metadata.deploy.remote-build or false; remoteBuild = metadata.deploy.remote-build or false;
profiles.system = { profiles.system = {
sshUser = "admin"; sshUser = metadata.deploy.ssh-user or "admin";
user = "root"; user = "root";
path = inputs.deploy.lib.${defaultSystem}.activate.nixos value; path = inputs.deploy.lib.${metadata.system or defaultSystem}.activate.nixos value;
}; };
}) })
self.nixosConfigurations; self.nixosConfigurations;
homeConfigurations = lib'.mapAttrs' homeConfigurations = lib'.mapAttrs'
(name: value: (name: value:
lib'.nameValuePair "home-manager-${name}" { let
hostname = name; metadata = users.${name};
fastConnection = true; username = metadata.deploy.username or name;
profiles.home = { in
sshUser = name; lib'.nameValuePair "home-manager-${name}" {
path = inputs.deploy.lib.${defaultSystem}.activate.home-manager value; hostname = metadata.deploy.hostname or name;
}; autoRollback = metadata.deploy.auto-rollback or true;
}) magicRollback = metadata.deploy.magic-rollback or true;
fastConnection = metadata.deploy.fast-connection or true;
remoteBuild = metadata.deploy.remote-build or false;
profiles.home = {
sshUser = metadata.deploy.ssh-user or username;
user = metadata.deploy.user or username;
path = inputs.deploy.lib.${metadata.system or defaultSystem}.activate.home-manager value;
};
})
self.homeConfigurations; self.homeConfigurations;
in in
nixosConfigurations // homeConfigurations; nixosConfigurations // homeConfigurations;