]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/aubergine/pixiecore.nix
use/op(aubergine,apcupsd): enable
[julm/julm-nix.git] / hosts / aubergine / pixiecore.nix
1 {
2 pkgs,
3 lib,
4 config,
5 inputs,
6 modulesPath,
7 ...
8 }@args:
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 system,
27 ...
28 }:
29 {
30 imports = [
31 (modulesPath + "/installer/netboot/netboot-minimal.nix")
32 ../../nixos/default.nix
33 ];
34 config = {
35 nixpkgs.hostPlatform = {
36 system = "x86_64-linux";
37 config = "x86_64-unknown-linux-gnu";
38 };
39 ## Some useful options for setting up a new system
40 services.getty.autologinUser = lib.mkForce "root";
41 users.users.root.openssh.authorizedKeys.keys =
42 hostConfig.users.users.julm.openssh.authorizedKeys.keys;
43 console.keyMap = "fr";
44 # hardware.video.hidpi.enable = true;
45
46 system.stateVersion = config.system.nixos.release;
47
48 _module.args = {
49 hostName = pxeHostName;
50 #hosts = nixosConfigurations;
51 #host = nixosConfigurations.${hostName}._module.args;
52 };
53 nixpkgs.overlays = import ../../nixpkgs/overlays.nix args;
54 documentation = {
55 enable = false;
56 doc.enable = false;
57 };
58 };
59 }
60 )
61 inputs.home-manager.nixosModules.home-manager
62 {
63 home-manager.useGlobalPkgs = true;
64 home-manager.useUserPackages = true;
65 home-manager.verbose = true;
66 #home-manager.force = true;
67 home-manager.backupFileExtension = "old";
68 home-manager.extraSpecialArgs = {
69 hostName = pxeHostName;
70 inherit inputs;
71 };
72 }
73 ];
74 };
75 build = nixos.config.system.build;
76 in
77 {
78 services.pixiecore = {
79 enable = true;
80 mode = "boot";
81 debug = true;
82 dhcpNoBind = true;
83 port = 64172;
84 statusPort = 64172;
85 kernel = "${build.kernel}/bzImage";
86 initrd = "${build.netbootRamdisk}/initrd";
87 cmdLine = "init=${build.toplevel}/init loglevel=4";
88 extraArguments = [ ];
89 };
90 networking.nftables.ruleset = ''
91 table inet filter {
92 chain input-lan {
93 udp dport 67 counter accept comment "Pixiecore/DHCP"
94 udp dport 69 counter accept comment "Pixiecore/TFTP"
95 udp dport 4011 counter accept comment "Pixiecore/ProxyDHCP"
96 tcp dport ${toString pixiecore.port} counter accept comment "Pixiecore"
97 tcp dport ${toString pixiecore.statusPort} counter accept comment "Pixiecore/status"
98 }
99 chain output-lan {
100 ip daddr 255.255.255.255 udp sport 67 udp dport 68 counter accept comment "Pixiecore"
101 meta l4proto udp counter accept comment "Pixiecore file sending"
102 }
103 }
104 '';
105 }