tvl-depot/users/flokli/nixos/default.nix
Florian Klink c37c9cc770 feat(users/flokli/nixos): add direnv support
Expose `deps` separately, add a direnv with PATH_add for it to bring
tooling into $PATH.

Change-Id: I432cd2b082cad89e08bef78dc4653e10e137cd6b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9842
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
2023-10-30 14:32:18 +00:00

40 lines
1.2 KiB
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-closure --to ${name} --gzip --use-substitutes ${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;
deploy-archeology = (deployScript "archeology" archeologySystem);
deploy-archeology-ec2 = (deployScript "archeology-ec2" archeologyEc2System);
deps = (depot.nix.lazy-deps {
deploy-archeology.attr = "users.flokli.nixos.deploy-archeology";
deploy-archeology-ec2.attr = "users.flokli.nixos.deploy-archeology-ec2";
});
shell = pkgs.mkShell {
name = "flokli-nixos-shell";
packages = [ deps ];
};
}