46 lines
1.2 KiB
Nix
46 lines
1.2 KiB
Nix
|
# Deploy with: nix build -f ./deploy.nix HOSTNAME && ./result
|
||
|
let
|
||
|
sources = import ./nix/sources.nix;
|
||
|
|
||
|
krops = sources.krops;
|
||
|
lib = import "${krops}/lib";
|
||
|
kropsPkgs = import "${krops}/pkgs" { };
|
||
|
|
||
|
kropsDeploy =
|
||
|
{ hostname
|
||
|
, target ? null
|
||
|
, extraSources ? { }
|
||
|
}:
|
||
|
let
|
||
|
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";
|
||
|
secrets.pass = {
|
||
|
dir = toString ~/.password-store;
|
||
|
name = "nixos/machines/${hostname}";
|
||
|
};
|
||
|
} // extraSources)
|
||
|
];
|
||
|
in
|
||
|
kropsPkgs.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"
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
in
|
||
|
builtins.mapAttrs (hostname: configuration: kropsDeploy { inherit hostname; } // configuration)
|
||
|
{
|
||
|
nunotaba = { };
|
||
|
sayuri = { };
|
||
|
}
|