2020-12-12 16:12:38 +01:00
|
|
|
{ hostname
|
|
|
|
, target ? null
|
|
|
|
, extraSources ? { }
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
sources = import ../nix/sources.nix;
|
|
|
|
krops = sources.krops;
|
|
|
|
lib = import "${krops}/lib";
|
|
|
|
pkgs = import "${krops}/pkgs" { };
|
|
|
|
|
|
|
|
source = lib.evalSource [
|
|
|
|
({
|
|
|
|
nixpkgs.git = {
|
|
|
|
ref = sources.nixpkgs.rev;
|
|
|
|
url = https://github.com/NixOS/nixpkgs;
|
|
|
|
shallow = true;
|
|
|
|
};
|
|
|
|
config.file = toString ../.;
|
|
|
|
nixos-config.symlink = "config/machines/${hostname}/configuration.nix";
|
2020-12-12 16:50:25 +01:00
|
|
|
secrets.pass = {
|
|
|
|
dir = toString ~/.password-store;
|
|
|
|
name = "nixos/machines/${hostname}";
|
|
|
|
};
|
2020-12-12 16:12:38 +01:00
|
|
|
} // extraSources)
|
|
|
|
];
|
|
|
|
in
|
|
|
|
pkgs.krops.writeDeploy "deploy-${hostname}" {
|
|
|
|
source = source;
|
|
|
|
target = lib.mkTarget (if target == null then "root@${hostname}" else target) // {
|
|
|
|
extraOptions = [
|
|
|
|
# force allocation of tty to allow aborting with ^C and to show build progress
|
|
|
|
"-t"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|