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