about summary refs log tree commit diff
path: root/users/flokli/nixos/default.nix
blob: eec0c974ecba255b3ab90221f2ea9d50e61cfb9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ 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)
    ];
  };
}