deploy: move logic to lib

This commit is contained in:
Timothy DeHerrera 2021-02-15 11:24:43 -07:00
parent ad49a5e7e7
commit 77296ff433
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122
2 changed files with 19 additions and 13 deletions

View file

@ -40,9 +40,9 @@
}:
let
inherit (utils.lib) eachDefaultSystem flattenTreeSystem;
inherit (nixos.lib) recursiveUpdate mapAttrs;
inherit (nixos.lib) recursiveUpdate;
inherit (self.lib) overlays nixosModules genPackages genPkgs
genHomeActivationPackages;
genHomeActivationPackages mkNodes;
extern = import ./extern { inherit inputs; };
@ -72,16 +72,7 @@
defaultTemplate = self.templates.flk;
deploy.nodes = mapAttrs
(_: config: {
hostname = config.config.networking.hostName;
profiles.system = {
user = "root";
path = deploy.lib.x86_64-linux.activate.nixos config;
};
})
self.nixosConfigurations;
deploy.nodes = mkNodes deploy self.nixosConfigurations;
checks = builtins.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy)

View file

@ -42,6 +42,21 @@ let
in
map fullPath (attrNames (readDir overlayDir));
/**
Synopsis: mkNodes _nixosConfigurations_
Generate the `nodes` attribute expected by deploy-rs
where _nixosConfigurations_ are `nodes`.
**/
mkNodes = deploy: mapAttrs (_: config: {
hostname = config.config.networking.hostName;
profiles.system = {
user = "root";
path = deploy.lib.x86_64-linux.activate.nixos config;
};
});
/**
Synopsis: importDefaults _path_
@ -72,7 +87,7 @@ let
in
{
inherit importDefaults mapFilterAttrs genAttrs' pkgImport
pathsToImportedAttrs;
pathsToImportedAttrs mkNodes;
overlays = pathsToImportedAttrs overlayPaths;