summaryrefslogtreecommitdiff
path: root/machines/iso/default.nix
blob: d27b26ea976cea56ad1a2ead6a94b2eeeaf58b41 (plain)
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
{ modulesPath, pkgs, ... }: {
  imports = [
    (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")
    (modulesPath + "/installer/cd-dvd/channel.nix")
  ];

  nix.settings = {
    experimental-features = [ "nix-command" "flakes" ];
  };

  environment.systemPackages = with pkgs; [
    bash
    git
    gum
    jq
    (writeShellScriptBin "xinstall" ''
      set -euo pipefail

      FLAKE="github:kbujari/depot/xnet"

      TARGET=$(
        nix flake show "$FLAKE" --json 2>/dev/null \
          | jq -r '.["nixosConfigurations"] | keys[] | select(. != "iso")' \
          | gum choose
      )

      gum confirm --default=false "This will erase the selected disk, confirm:"

      echo selected "$FLAKE"#"$TARGET"
    '')
  ];
}