Add unbound config nix package
authorYethal <redacted>
Tue, 11 Mar 2025 17:44:50 +0000 (18:44 +0100)
committerBobbe <redacted>
Mon, 27 Apr 2026 12:11:42 +0000 (14:11 +0200)
flake.nix
unbound.nix [new file with mode: 0644]

index 27abbe1f37f8e0feb117b28d91aa5775a33e9084..342068f6bfcd4f2e1c7253e8efb9f3d8cf30b4af 100644 (file)
--- a/flake.nix
+++ b/flake.nix
               python3Packages.requests
             ];
           };
-        });
+        }
+      );
+
+      packages = forAllSystems (system: {
+        unbound = nixpkgsFor.${system}.callPackage ./unbound.nix { };
+      });
     };
 }
diff --git a/unbound.nix b/unbound.nix
new file mode 100644 (file)
index 0000000..72551f2
--- /dev/null
@@ -0,0 +1,19 @@
+{
+  stdenvNoCC,
+}:
+stdenvNoCC.mkDerivation {
+  name = "stevenblack-hosts-unbound";
+  src = ./.;
+
+  installPhase =
+    let
+      toUnboundConf = ''awk 'NF == 2 && $1 == "0.0.0.0" && $2 != "0.0.0.0" { printf "local-zone: \"%s\" always_nxdomain\n", $2 }'\'';
+    in
+    ''
+      mkdir $out
+      cat $src/hosts | ${toUnboundConf} > $out/hosts
+      for file in alternates/*/hosts; do
+        cat $file | ${toUnboundConf} > $out/$(basename $(dirname $file))
+      done
+    '';
+}
git clone https://git.99rst.org/PROJECT