about summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
authorvolth <volth@volth.com>2019-12-12 23:49:47 +0000
committervolth <volth@volth.com>2019-12-12 23:49:47 +0000
commit018c0445ba9b9ecbad4aee1ae93b45adf187c9f2 (patch)
tree9651d9d9c70296d44800fb73c40be51b743da03f /nixos/modules/services/networking
parentcf5c943f45a377b0cbe5ad237e8de77de93d5fc8 (diff)
downloadnixlib-018c0445ba9b9ecbad4aee1ae93b45adf187c9f2.tar
nixlib-018c0445ba9b9ecbad4aee1ae93b45adf187c9f2.tar.gz
nixlib-018c0445ba9b9ecbad4aee1ae93b45adf187c9f2.tar.bz2
nixlib-018c0445ba9b9ecbad4aee1ae93b45adf187c9f2.tar.lz
nixlib-018c0445ba9b9ecbad4aee1ae93b45adf187c9f2.tar.xz
nixlib-018c0445ba9b9ecbad4aee1ae93b45adf187c9f2.tar.zst
nixlib-018c0445ba9b9ecbad4aee1ae93b45adf187c9f2.zip
nixos/unbound: add package option
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r--nixos/modules/services/networking/unbound.nix13
1 files changed, 10 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix
index 3cf82e8839bb..baed83591e1e 100644
--- a/nixos/modules/services/networking/unbound.nix
+++ b/nixos/modules/services/networking/unbound.nix
@@ -53,6 +53,13 @@ in
 
       enable = mkEnableOption "Unbound domain name server";
 
+      package = mkOption {
+        type = types.package;
+        default = pkgs.unbound;
+        defaultText = "pkgs.unbound";
+        description = "The unbound package to use";
+      };
+
       allowedAccess = mkOption {
         default = [ "127.0.0.0/24" ];
         type = types.listOf types.str;
@@ -94,7 +101,7 @@ in
 
   config = mkIf cfg.enable {
 
-    environment.systemPackages = [ pkgs.unbound ];
+    environment.systemPackages = [ cfg.package ];
 
     users.users.unbound = {
       description = "unbound daemon user";
@@ -114,7 +121,7 @@ in
         mkdir -m 0755 -p ${stateDir}/dev/
         cp ${confFile} ${stateDir}/unbound.conf
         ${optionalString cfg.enableRootTrustAnchor ''
-          ${pkgs.unbound}/bin/unbound-anchor -a ${rootTrustAnchorFile} || echo "Root anchor updated!"
+          ${cfg.package}/bin/unbound-anchor -a ${rootTrustAnchorFile} || echo "Root anchor updated!"
           chown unbound ${stateDir} ${rootTrustAnchorFile}
         ''}
         touch ${stateDir}/dev/random
@@ -122,7 +129,7 @@ in
       '';
 
       serviceConfig = {
-        ExecStart = "${pkgs.unbound}/bin/unbound -d -c ${stateDir}/unbound.conf";
+        ExecStart = "${cfg.package}/bin/unbound -d -c ${stateDir}/unbound.conf";
         ExecStopPost="${pkgs.utillinux}/bin/umount ${stateDir}/dev/random";
 
         ProtectSystem = true;