From a0d7b889110893c2a27178dd5d7ef327dd834d74 Mon Sep 17 00:00:00 2001
From: Michael Weiss <dev.primeos@gmail.com>
Date: Sat, 8 Sep 2018 13:04:19 +0200
Subject: [PATCH] nixos/sks: Add a dataDir option

---
 nixos/modules/services/security/sks.nix | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/nixos/modules/services/security/sks.nix b/nixos/modules/services/security/sks.nix
index 62308428f32..acc2a128b15 100644
--- a/nixos/modules/services/security/sks.nix
+++ b/nixos/modules/services/security/sks.nix
@@ -27,6 +27,20 @@ in
         ";
       };
 
+      dataDir = mkOption {
+        type = types.path;
+        default = "/var/db/sks";
+        example = "/var/lib/sks";
+        # TODO: The default might change to "/var/lib/sks" as this is more
+        # common. There's also https://github.com/NixOS/nixpkgs/issues/26256
+        # and "/var/db" is not FHS compliant (seems to come from BSD).
+        description = ''
+          Data directory (-basedir) for SKS, where the database and all
+          configuration files are located (e.g. KDB, PTree, membership and
+          sksconf).
+        '';
+      };
+
       hkpAddress = mkOption {
         default = [ "127.0.0.1" "::1" ];
         type = types.listOf types.str;
@@ -51,7 +65,7 @@ in
     
     users.users.sks = {
       createHome = true;
-      home = "/var/db/sks";
+      home = cfg.dataDir;
       isSystemUser = true;
       shell = "${pkgs.coreutils}/bin/true";
     };