nix fmt
Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
This commit is contained in:
parent
a3187e163d
commit
900f95169f
83 changed files with 1134 additions and 705 deletions
|
@ -16,36 +16,42 @@ rec {
|
|||
## ```
|
||||
##
|
||||
#@ { self: Flake, overrides: Attrs ? {} } -> Attrs
|
||||
mkDeploy = { self, overrides ? { } }:
|
||||
mkDeploy =
|
||||
{
|
||||
self,
|
||||
overrides ? { },
|
||||
}:
|
||||
let
|
||||
hosts = self.nixosConfigurations or { };
|
||||
names = builtins.attrNames hosts;
|
||||
nodes = lib.foldl
|
||||
(result: name:
|
||||
let
|
||||
host = hosts.${name};
|
||||
user = host.config.metacfg.user.name or null;
|
||||
inherit (host.pkgs) system;
|
||||
in
|
||||
result // {
|
||||
${name} = (overrides.${name} or { }) // {
|
||||
hostname = overrides.${name}.hostname or "${name}";
|
||||
profiles = (overrides.${name}.profiles or { }) // {
|
||||
system = (overrides.${name}.profiles.system or { }) // {
|
||||
nodes = lib.foldl (
|
||||
result: name:
|
||||
let
|
||||
host = hosts.${name};
|
||||
user = host.config.metacfg.user.name or null;
|
||||
inherit (host.pkgs) system;
|
||||
in
|
||||
result
|
||||
// {
|
||||
${name} = (overrides.${name} or { }) // {
|
||||
hostname = overrides.${name}.hostname or "${name}";
|
||||
profiles = (overrides.${name}.profiles or { }) // {
|
||||
system =
|
||||
(overrides.${name}.profiles.system or { })
|
||||
// {
|
||||
path = deploy-rs.lib.${system}.activate.nixos host;
|
||||
} // lib.optionalAttrs (user != null) {
|
||||
}
|
||||
// lib.optionalAttrs (user != null) {
|
||||
user = "root";
|
||||
sshUser = user;
|
||||
} // lib.optionalAttrs
|
||||
(host.config.metacfg.security.doas.enable or false)
|
||||
{
|
||||
sudo = "doas -u";
|
||||
};
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs (host.config.metacfg.security.doas.enable or false) { sudo = "doas -u"; };
|
||||
};
|
||||
})
|
||||
{ }
|
||||
names;
|
||||
};
|
||||
}
|
||||
) { } names;
|
||||
in
|
||||
{ inherit nodes; };
|
||||
{
|
||||
inherit nodes;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue