From a3644a38a5f8af779d7db64cdaa6468240ae37d3 Mon Sep 17 00:00:00 2001
From: tv <tv@krebsco.de>
Date: Tue, 7 Jun 2016 22:49:26 +0200
Subject: [PATCH] krebs.git: make user configurable

---
 krebs/3modules/git.nix | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/krebs/3modules/git.nix b/krebs/3modules/git.nix
index 9bc56fc85..aabf4614f 100644
--- a/krebs/3modules/git.nix
+++ b/krebs/3modules/git.nix
@@ -87,6 +87,14 @@ let
         access and permission rules for git repositories.
       '';
     };
+
+    user = mkOption {
+      type = types.user;
+      default = {
+        name = "git";
+        home = "/var/lib/git";
+      };
+    };
   };
 
   # TODO put into krebs/4lib/types.nix?
@@ -303,16 +311,15 @@ let
         ]) (filter (rule: rule.perm.allow-receive-ref != null) cfg.rules));
       };
 
-    # TODO cfg.user
-    users.users.git = rec {
+    users.users.${cfg.user.name} = {
+      inherit (cfg.user) home name uid;
+      createHome = true;
       description = "Git repository hosting user";
-      name = "git";
       shell = "/bin/sh";
       openssh.authorizedKeys.keys =
         mapAttrsToList (_: makeAuthorizedKey git-ssh-command)
                        (filterAttrs (_: user: isString user.pubkey)
                                     config.krebs.users);
-      uid = genid name;
     };
   };