]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/aubergine/pixiecore.nix
aubergine: pixiecore: not sure if iPXE works as fast as it could, but it does boot...
[julm/julm-nix.git] / hosts / aubergine / pixiecore.nix
1 {
2 pkgs,
3 lib,
4 config,
5 inputs,
6 modulesPath,
7 ...
8 }:
9 let
10 hostConfig = config;
11 pixiecore = config.services.pixiecore;
12 pxeHostName = "nixos-pxe";
13 nixos = import (modulesPath + "/../lib/eval-config.nix") {
14 system = null;
15 specialArgs = {
16 # Required to avoid infinite recursion
17 # when `inputs` is used in `imports`.
18 inherit inputs;
19 };
20 modules = [
21 (
22 {
23 config,
24 pkgs,
25 lib,
26 ...
27 }:
28 {
29 imports = [
30 (modulesPath + "/installer/netboot/netboot-minimal.nix")
31 ../../nixos/default.nix
32 ];
33 config = {
34 nixpkgs.hostPlatform = {
35 system = "x86_64-linux";
36 config = "x86_64-unknown-linux-gnu";
37 };
38 ## Some useful options for setting up a new system
39 services.getty.autologinUser = lib.mkForce "root";
40 users.users.root.openssh.authorizedKeys.keys =
41 hostConfig.users.users.julm.openssh.authorizedKeys.keys;
42 console.keyMap = "fr";
43 # hardware.video.hidpi.enable = true;
44
45 system.stateVersion = config.system.nixos.release;
46
47 _module.args = {
48 hostName = pxeHostName;
49 #hosts = nixosConfigurations;
50 #host = nixosConfigurations.${hostName}._module.args;
51 };
52 nixpkgs.overlays = import ../../nixpkgs/overlays.nix;
53 documentation = {
54 enable = false;
55 doc.enable = false;
56 };
57 };
58 }
59 )
60 inputs.home-manager.nixosModules.home-manager
61 {
62 home-manager.useGlobalPkgs = true;
63 home-manager.useUserPackages = true;
64 home-manager.verbose = true;
65 #home-manager.force = true;
66 home-manager.backupFileExtension = "old";
67 home-manager.extraSpecialArgs = {
68 hostName = pxeHostName;
69 inherit inputs;
70 };
71 }
72 ];
73 };
74 build = nixos.config.system.build;
75 in
76 {
77 services.pixiecore = {
78 enable = true;
79 mode = "boot";
80 debug = true;
81 dhcpNoBind = true;
82 port = 64172;
83 statusPort = 64172;
84 kernel = "${build.kernel}/bzImage";
85 initrd = "${build.netbootRamdisk}/initrd";
86 cmdLine = "init=${build.toplevel}/init loglevel=4";
87 extraArguments = [ ];
88 };
89 networking.nftables.ruleset = ''
90 table inet filter {
91 chain input-lan {
92 udp dport 67 counter accept comment "Pixiecore/DHCP"
93 udp dport 69 counter accept comment "Pixiecore/TFTP"
94 udp dport 4011 counter accept comment "Pixiecore/ProxyDHCP"
95 tcp dport ${toString pixiecore.port} counter accept comment "Pixiecore"
96 tcp dport ${toString pixiecore.statusPort} counter accept comment "Pixiecore/status"
97 }
98 chain output-lan {
99 ip daddr 255.255.255.255 udp sport 67 udp dport 68 counter accept comment "Pixiecore"
100 }
101 }
102 '';
103 }