summaryrefslogtreecommitdiff
path: root/profiles/netboot/system.nix
blob: b0e79457c97ac2de4398f10f0159c40d7782d831 (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
sys: { pkgs, lib, ... }: let
  run-pixiecore = let
      build = sys.config.system.build;
    in pkgs.writeShellApplication {
      name = "run-pixiecore";
      text = ''
        sudo ${pkgs.pixiecore}/bin/pixiecore \
          boot kernel/bzImage initrd/initrd \
          --cmdline "init=init/init loglevel=4" \
          --debug --dhcp-no-bind \
          --port 64172 --status-port 64172 "$@"
      '';
    };
  build-pixie = pkgs.writeShellApplication {
      name = "build-pixie";
      text = ''
        nix build /nix-config\#nixosConfigurations."$1".config.system.build.kernel --impure -o kernel
        nix build /nix-config\#nixosConfigurations."$1".config.system.build.toplevel --impure -o init
        nix build /nix-config\#nixosConfigurations."$1".config.system.build.netbootRamdisk --impure -o initrd
      '';
    };
in {
  networking.firewall.allowedUDPPorts = [ 67 69 4011 ];
  networking.firewall.allowedTCPPorts = [ 64172 ];
  environment.systemPackages = [
    run-pixiecore
    build-pixie
  ];
}