Decouple machine configuration and deployment

This allows custom scripts to access machine-specific variables.
This commit is contained in:
Simon Bruder 2021-01-28 17:08:08 +01:00
parent 204962d0f3
commit e7c6406820
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
2 changed files with 22 additions and 6 deletions

View file

@ -45,7 +45,7 @@ let
in
kropsPkgs.krops.writeDeploy "deploy-${hostname}" {
source = source;
target = lib.mkTarget (if target == null then "root@${hostname}" else target) // {
target = lib.mkTarget target // {
extraOptions = [
# force allocation of tty to allow aborting with ^C and to show build progress
"-t"
@ -53,8 +53,6 @@ let
};
};
in
builtins.mapAttrs (hostname: configuration: kropsDeploy ({ inherit hostname; } // configuration))
{
nunotaba = { };
sayuri = { };
}
builtins.mapAttrs
(hostname: configuration: kropsDeploy ({ inherit hostname; } // configuration))
(import ./machines)

18
machines/default.nix Normal file
View file

@ -0,0 +1,18 @@
let
sources = import ../nix/sources.nix;
pkgs = import sources.nixpkgs { };
lib = pkgs.lib;
in
lib.mapAttrs
(hostname: options: {
inherit hostname;
target =
if lib.hasAttr "target" options
then options.target
else "root@${hostname}";
})
{
nunotaba = { };
sayuri = { };
}