diff --git a/nixos/modules/services/misc/gitolite.nix b/nixos/modules/services/misc/gitolite.nix index 89f72c046755..779a9ac9929d 100644 --- a/nixos/modules/services/misc/gitolite.nix +++ b/nixos/modules/services/misc/gitolite.nix @@ -1,7 +1,4 @@ { config, lib, pkgs, ... }: - -with lib; - let cfg = config.services.gitolite; # Use writeTextDir to not leak Nix store hash into file name @@ -11,8 +8,8 @@ in { options = { services.gitolite = { - enable = mkOption { - type = types.bool; + enable = lib.mkOption { + type = lib.types.bool; default = false; description = '' Enable gitolite management under the @@ -22,8 +19,8 @@ in ''; }; - dataDir = mkOption { - type = types.str; + dataDir = lib.mkOption { + type = lib.types.str; default = "/var/lib/gitolite"; description = '' The gitolite home directory used to store all repositories. If left as the default value @@ -33,8 +30,8 @@ in ''; }; - adminPubkey = mkOption { - type = types.str; + adminPubkey = lib.mkOption { + type = lib.types.str; description = '' Initial administrative public key for Gitolite. This should be an SSH Public Key. Note that this key will only be used @@ -43,8 +40,8 @@ in ''; }; - enableGitAnnex = mkOption { - type = types.bool; + enableGitAnnex = lib.mkOption { + type = lib.types.bool; default = false; description = '' Enable git-annex support. Uses the `extraGitoliteRc` option @@ -52,18 +49,18 @@ in ''; }; - commonHooks = mkOption { - type = types.listOf types.path; + commonHooks = lib.mkOption { + type = lib.types.listOf lib.types.path; default = []; description = '' A list of custom git hooks that get copied to `~/.gitolite/hooks/common`. ''; }; - extraGitoliteRc = mkOption { - type = types.lines; + extraGitoliteRc = lib.mkOption { + type = lib.types.lines; default = ""; - example = literalExpression '' + example = lib.literalExpression '' ''' $RC{UMASK} = 0027; $RC{SITE_INFO} = 'This is our private repository host'; @@ -93,24 +90,24 @@ in ''; }; - user = mkOption { - type = types.str; + user = lib.mkOption { + type = lib.types.str; default = "gitolite"; description = '' Gitolite user account. This is the username of the gitolite endpoint. ''; }; - description = mkOption { - type = types.str; + description = lib.mkOption { + type = lib.types.str; default = "Gitolite user"; description = '' Gitolite user account's description. ''; }; - group = mkOption { - type = types.str; + group = lib.mkOption { + type = lib.types.str; default = "gitolite"; description = '' Primary group of the Gitolite user account. @@ -119,7 +116,7 @@ in }; }; - config = mkIf cfg.enable ( + config = lib.mkIf cfg.enable ( let manageGitoliteRc = cfg.extraGitoliteRc != ""; rcDir = pkgs.runCommand "gitolite-rc" { preferLocalBuild = true; } rcDirScript; @@ -136,18 +133,18 @@ in END cat "$out/gitolite.rc.default" >>"$out/gitolite.rc" '' + - optionalString (cfg.extraGitoliteRc != "") '' - echo -n ${escapeShellArg '' + lib.optionalString (cfg.extraGitoliteRc != "") '' + echo -n ${lib.escapeShellArg '' # Added by NixOS: - ${removeSuffix "\n" cfg.extraGitoliteRc} + ${lib.removeSuffix "\n" cfg.extraGitoliteRc} # per perl rules, this should be the last line in such a file: 1; ''} >>"$out/gitolite.rc" ''; in { - services.gitolite.extraGitoliteRc = optionalString cfg.enableGitAnnex '' + services.gitolite.extraGitoliteRc = lib.optionalString cfg.enableGitAnnex '' # Enable git-annex support: push( @{$RC{ENABLE}}, 'git-annex-shell ua'); ''; @@ -171,8 +168,8 @@ in GITOLITE_RC_DEFAULT = "${rcDir}/gitolite.rc.default"; }; - serviceConfig = mkMerge [ - (mkIf (cfg.dataDir == "/var/lib/gitolite") { + serviceConfig = lib.mkMerge [ + (lib.mkIf (cfg.dataDir == "/var/lib/gitolite") { StateDirectory = "gitolite gitolite/.gitolite gitolite/.gitolite/logs"; StateDirectoryMode = "0750"; }) @@ -236,6 +233,6 @@ in }; environment.systemPackages = [ pkgs.gitolite pkgs.git ] - ++ optional cfg.enableGitAnnex pkgs.git-annex; + ++ lib.optional cfg.enableGitAnnex pkgs.git-annex; }); }