tvl-depot/users/flokli/nixos/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1,015 B
Nix
Raw Normal View History

{ 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;
shell = pkgs.mkShell {
name = "flokli-nixos-shell";
packages = [
(deployScript "archeology" archeologySystem)
(deployScript "archeology-ec2" archeologyEc2System)
];
};
}