summaryrefslogtreecommitdiff
path: root/machines/radon/pxeboot.nix
blob: 0b5df13668c9f0caa5b1d5ef83082ae2ab9b5aeb (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ pkgs, lib, ... }:
let
  installer = lib.nixosSystem {
    system = "x86_64-linux";
    modules = [
      (
        {
          config,
          pkgs,
          lib,
          modulesPath,
          ...
        }:
        {
          imports = [
            (modulesPath + "/installer/netboot/netboot-minimal.nix")
            (modulesPath + "/installer/cd-dvd/channel.nix")
          ];

          services.openssh = {
            enable = true;
            openFirewall = true;
            settings = {
              PasswordAuthentication = false;
              KbdInteractiveAuthentication = false;
            };
          };

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

          users.users.root.openssh.authorizedKeys.keys = [
            "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP7T2uWJFUu8aFZZgQusGKyEMocb2pKbHLDad2eIJus9"
            "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEOw8YEbHsKy38JHp9W1wcxxZgWCDgnabOXccZUN5ddd"
          ];
        }
      )
    ];
  };

  inherit (installer.config.system) build;
in
{
  services.pixiecore = {
    enable = true;
    openFirewall = true;
    kernel = "${build.kernel}/bzImage";
    initrd = "${build.netbootRamdisk}/initrd";
    cmdLine = "init=${build.toplevel}/init loglevel=4";
    mode = "boot";
    port = 8001;
    statusPort = 8001;

    # Piggyback on existing network DHCP
    dhcpNoBind = true;
  };
}