summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/networking/git-daemon.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2014-11-07 15:49:45 +0300
committerNikolay Amiantov <ab@fmap.me>2014-11-07 15:49:45 +0300
commitaf1d09879bf3546652c00efb7129e62a94534759 (patch)
treeff7a8f0a1c00ffa74fbfa93ee88f818c07ef0351 /nixos/modules/services/networking/git-daemon.nix
parent4b2e43865afe8d361dd6ed4bd7e17e2c300a0231 (diff)
nixos/git-daemon: add 'user' and 'group' options
Diffstat (limited to 'nixos/modules/services/networking/git-daemon.nix')
-rw-r--r--nixos/modules/services/networking/git-daemon.nix23
1 files changed, 17 insertions, 6 deletions
diff --git a/nixos/modules/services/networking/git-daemon.nix b/nixos/modules/services/networking/git-daemon.nix
index 29072ed7839d..8c9243463aca 100644
--- a/nixos/modules/services/networking/git-daemon.nix
+++ b/nixos/modules/services/networking/git-daemon.nix
@@ -3,7 +3,6 @@ with lib;
let
cfg = config.services.gitDaemon;
- gitUser = "git";
in
{
@@ -86,6 +85,18 @@ in
description = "Extra configuration options to be passed to Git daemon.";
};
+ user = mkOption {
+ type = types.str;
+ default = "git";
+ description = "User under which Git daemon would be running.";
+ };
+
+ group = mkOption {
+ type = types.str;
+ default = "git";
+ description = "Group under which Git daemon would be running.";
+ };
+
};
};
@@ -93,14 +104,14 @@ in
config = mkIf cfg.enable {
- users.extraUsers = singleton
- { name = gitUser;
+ users.extraUsers = if cfg.user != "git" then {} else singleton
+ { name = "git";
uid = config.ids.uids.git;
description = "Git daemon user";
};
- users.extraGroups = singleton
- { name = gitUser;
+ users.extraGroups = if cfg.group != "git" then {} else singleton
+ { name = "git";
gid = config.ids.gids.git;
};
@@ -110,7 +121,7 @@ in
exec = "${pkgs.git}/bin/git daemon --reuseaddr "
+ (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ")
+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
- + "--port=${toString cfg.port} --user=${gitUser} --group=${gitUser} ${cfg.options} "
+ + "--port=${toString cfg.port} --user=${cfg.user} --group=${cfg.group} ${cfg.options} "
+ "--verbose " + (optionalString cfg.exportAll "--export-all") + concatStringsSep " " cfg.repositories;
};