tvl-depot/users/flokli/nixos/default.nix
Florian Klink d83b574be7 feat(users/flokli): expose readTree targets to CI
Change-Id: I3ea801b47267f4c985c2ab5cb1b79b2659894307
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9838
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
2023-10-30 12:15:35 +00:00

35 lines
1,007 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
depot.nix.readTree.drvTargets 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)
];
};
}