zaphyra's git: nixfiles

zaphyra and void's nixfiles

commit c7ff95937fd7f48c0083ee411ebcadfe43128892
parent c1254267c3cb39fb2f32e6f6e6d84763b5676fd5
Author: Katja (ctucx) <git@ctu.cx>
Date: Tue, 20 May 2025 12:50:46 +0200

config/nixos/modules/presets: add `netcup` (setup network and kernel-modules)
1 file changed, 43 insertions(+), 0 deletions(-)
A
config/nixos/modules/presets/netcup.nix
|
43
+++++++++++++++++++++++++++++++++++++++++++
diff --git a/config/nixos/modules/presets/netcup.nix b/config/nixos/modules/presets/netcup.nix
@@ -0,0 +1,43 @@
+{
+  povSelf,
+  pkgs,
+  lib,
+  config,
+  hostConfig,
+  ...
+}:
+let
+  inherit (lib) types;
+  cfg = lib.getAttrFromPath povSelf config;
+
+in
+{
+
+  options = {
+    enable = {
+      type = types.bool;
+      default = false;
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
+
+    systemd.network.networks."5-ens3" = {
+      enable  = true;
+      name    = "ens3";
+      dns     = [
+        "46.38.225.230"
+        "46.38.252.230"
+        "2a03:4000:0:1::e1e6"
+        "2a03:4000:8000::fce6"
+      ];
+      gateway = [ hostConfig.networking.defaultGateway6 hostConfig.networking.defaultGateway4 ];
+      address = [
+        "${hostConfig.networking.ip6Address}/${toString hostConfig.networking.ip6PrefixLength}"
+        "${hostConfig.networking.ip4Address}/${toString hostConfig.networking.ip4PrefixLength}"
+      ];
+    };
+  };
+
+}