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
|
let
|
||||||
inherit (utils.lib) eachDefaultSystem flattenTreeSystem;
|
inherit (utils.lib) eachDefaultSystem flattenTreeSystem;
|
||||||
inherit (nixos.lib) recursiveUpdate mapAttrs;
|
inherit (nixos.lib) recursiveUpdate;
|
||||||
inherit (self.lib) overlays nixosModules genPackages genPkgs
|
inherit (self.lib) overlays nixosModules genPackages genPkgs
|
||||||
genHomeActivationPackages;
|
genHomeActivationPackages mkNodes;
|
||||||
|
|
||||||
extern = import ./extern { inherit inputs; };
|
extern = import ./extern { inherit inputs; };
|
||||||
|
|
||||||
@ -72,16 +72,7 @@
|
|||||||
|
|
||||||
defaultTemplate = self.templates.flk;
|
defaultTemplate = self.templates.flk;
|
||||||
|
|
||||||
deploy.nodes = mapAttrs
|
deploy.nodes = mkNodes deploy self.nixosConfigurations;
|
||||||
(_: config: {
|
|
||||||
hostname = config.config.networking.hostName;
|
|
||||||
|
|
||||||
profiles.system = {
|
|
||||||
user = "root";
|
|
||||||
path = deploy.lib.x86_64-linux.activate.nixos config;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
self.nixosConfigurations;
|
|
||||||
|
|
||||||
checks = builtins.mapAttrs
|
checks = builtins.mapAttrs
|
||||||
(system: deployLib: deployLib.deployChecks self.deploy)
|
(system: deployLib: deployLib.deployChecks self.deploy)
|
||||||
|
@ -42,6 +42,21 @@ let
|
|||||||
in
|
in
|
||||||
map fullPath (attrNames (readDir overlayDir));
|
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_
|
Synopsis: importDefaults _path_
|
||||||
|
|
||||||
@ -72,7 +87,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit importDefaults mapFilterAttrs genAttrs' pkgImport
|
inherit importDefaults mapFilterAttrs genAttrs' pkgImport
|
||||||
pathsToImportedAttrs;
|
pathsToImportedAttrs mkNodes;
|
||||||
|
|
||||||
overlays = pathsToImportedAttrs overlayPaths;
|
overlays = pathsToImportedAttrs overlayPaths;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user