tvl-depot/users/flokli/nixos/default.nix
Florian Klink 71fa4110fa feat(users/flokli): add archeology-ec2
This add the EC2 box config to the repo.

Change-Id: Id7a888a2cfbf1454cd9f9465018df377e14b4e9f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9836
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
2023-10-30 09:31:49 +00:00

35 lines
977 B
Nix

{ depot, pkgs, lib, ... }:
let
systemFor = sys: (depot.ops.nixos.nixosFor sys).system;
# assumes `name` is configured appropriately in your .ssh/config
deployScript = name: sys: pkgs.writeShellScriptBin "deploy-${name}" ''
set -eo pipefail
nix copy --no-check-sigs --to ssh-ng://${name} ${sys}
ssh ${name} nix-env --profile /nix/var/nix/profiles/system --set ${sys}
ssh ${name} ${sys}/bin/switch-to-configuration switch
'';
in
rec {
archeologySystem = (depot.ops.nixos.nixosFor ({ ... }: {
imports = [
./archeology/configuration.nix
];
})).config.system.build.toplevel;
archeologyEc2System = (depot.ops.nixos.nixosFor ({ ... }: {
imports = [
./archeology-ec2/configuration.nix
];
})).config.system.build.toplevel;
shell = pkgs.mkShell {
name = "flokli-nixos-shell";
packages = [
(deployScript "archeology" archeologySystem)
(deployScript "archeology-ec2" archeologyEc2System)
];
};
}