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
# 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
# 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
@ -425,7 +421,9 @@
let
nixosConfigurations = lib'.mapAttrs'
(name: value:
let metadata = images.${name}; in
let
metadata = images.${name};
in
lib'.nameValuePair "nixos-${name}" {
hostname = metadata.deploy.hostname or name;
autoRollback = metadata.deploy.auto-rollback or true;
@ -433,20 +431,28 @@
fastConnection = metadata.deploy.fast-connection or true;
remoteBuild = metadata.deploy.remote-build or false;
profiles.system = {
sshUser = "admin";
sshUser = metadata.deploy.ssh-user or "admin";
user = "root";
path = inputs.deploy.lib.${defaultSystem}.activate.nixos value;
path = inputs.deploy.lib.${metadata.system or defaultSystem}.activate.nixos value;
};
})
self.nixosConfigurations;
homeConfigurations = lib'.mapAttrs'
(name: value:
let
metadata = users.${name};
username = metadata.deploy.username or name;
in
lib'.nameValuePair "home-manager-${name}" {
hostname = name;
fastConnection = true;
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 = name;
path = inputs.deploy.lib.${defaultSystem}.activate.home-manager value;
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;