2023-10-29 17:28:20 +01:00
|
|
|
{ depot, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
systemFor = sys: (depot.ops.nixos.nixosFor sys).system;
|
|
|
|
|
2023-10-29 18:39:21 +01:00
|
|
|
# assumes `name` is configured appropriately in your .ssh/config
|
|
|
|
deployScript = name: sys: pkgs.writeShellScriptBin "deploy-${name}" ''
|
|
|
|
set -eo pipefail
|
2023-10-30 11:05:11 +01:00
|
|
|
nix-copy-closure --to ${name} --gzip --use-substitutes ${sys}
|
2023-10-29 18:39:21 +01:00
|
|
|
ssh ${name} nix-env --profile /nix/var/nix/profiles/system --set ${sys}
|
|
|
|
ssh ${name} ${sys}/bin/switch-to-configuration switch
|
|
|
|
'';
|
|
|
|
|
2023-10-29 17:28:20 +01:00
|
|
|
in
|
2023-10-30 10:57:12 +01:00
|
|
|
depot.nix.readTree.drvTargets rec {
|
2023-10-29 18:28:07 +01:00
|
|
|
archeologySystem = (depot.ops.nixos.nixosFor ({ ... }: {
|
2023-10-29 17:28:20 +01:00
|
|
|
imports = [
|
|
|
|
./archeology/configuration.nix
|
|
|
|
];
|
|
|
|
})).config.system.build.toplevel;
|
2023-10-29 18:39:21 +01:00
|
|
|
|
2023-10-30 10:21:26 +01:00
|
|
|
archeologyEc2System = (depot.ops.nixos.nixosFor ({ ... }: {
|
|
|
|
imports = [
|
|
|
|
./archeology-ec2/configuration.nix
|
|
|
|
];
|
|
|
|
})).config.system.build.toplevel;
|
|
|
|
|
2023-10-30 11:21:30 +01:00
|
|
|
deploy-archeology = (deployScript "archeology" archeologySystem);
|
|
|
|
deploy-archeology-ec2 = (deployScript "archeology-ec2" archeologyEc2System);
|
|
|
|
|
2023-10-30 15:21:16 +01:00
|
|
|
deps = (depot.nix.lazy-deps {
|
|
|
|
deploy-archeology.attr = "users.flokli.nixos.deploy-archeology";
|
|
|
|
deploy-archeology-ec2.attr = "users.flokli.nixos.deploy-archeology-ec2";
|
|
|
|
});
|
|
|
|
|
2023-10-29 18:39:21 +01:00
|
|
|
shell = pkgs.mkShell {
|
|
|
|
name = "flokli-nixos-shell";
|
2023-10-30 15:21:16 +01:00
|
|
|
packages = [ deps ];
|
2023-10-29 18:39:21 +01:00
|
|
|
};
|
2023-10-29 17:28:20 +01:00
|
|
|
}
|