deploy: move logic to lib
This commit is contained in:
parent
ad49a5e7e7
commit
77296ff433
15
flake.nix
15
flake.nix
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user