diff options
author | Edward Tjörnhammar <ed@cflags.cc> | 2015-08-03 22:27:43 +0200 |
---|---|---|
committer | Edward Tjörnhammar <ed@cflags.cc> | 2015-08-03 22:29:47 +0200 |
commit | 727e2b5237824e28d89056fd8b66ad0f7c5aa694 (patch) | |
tree | 9c25b128496d7db93c58660fb62dc2bfcba67dfc /nixos/modules/services/misc/gitit.nix | |
parent | 1e2d3f3b5f7c67d3462355fa81d408bbdad63cd7 (diff) | |
download | nixpkgs-727e2b5237824e28d89056fd8b66ad0f7c5aa694.tar nixpkgs-727e2b5237824e28d89056fd8b66ad0f7c5aa694.tar.gz nixpkgs-727e2b5237824e28d89056fd8b66ad0f7c5aa694.tar.bz2 nixpkgs-727e2b5237824e28d89056fd8b66ad0f7c5aa694.tar.lz nixpkgs-727e2b5237824e28d89056fd8b66ad0f7c5aa694.tar.xz nixpkgs-727e2b5237824e28d89056fd8b66ad0f7c5aa694.tar.zst nixpkgs-727e2b5237824e28d89056fd8b66ad0f7c5aa694.zip |
nixos: gitit service, add all different repo initalizers
Diffstat (limited to 'nixos/modules/services/misc/gitit.nix')
-rw-r--r-- | nixos/modules/services/misc/gitit.nix | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/nixos/modules/services/misc/gitit.nix b/nixos/modules/services/misc/gitit.nix index b23bbaef5f7..10a706fbd71 100644 --- a/nixos/modules/services/misc/gitit.nix +++ b/nixos/modules/services/misc/gitit.nix @@ -19,9 +19,6 @@ let in writeScript "gitit" '' #!${stdenv.shell} cd $HOME - export PATH="${makeSearchPath "bin" ( - [ git curl ] ++ (if cfg.pdfExport then [texLiveFull] else []) - )}:$PATH"; export NIX_GHC="${env}/bin/ghc" export NIX_GHCPKG="${env}/bin/ghc-pkg" export NIX_GHC_DOCDIR="${env}/share/doc/ghc/html" @@ -624,8 +621,16 @@ in description = "Git and Pandoc Powered Wiki"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; - - preStart = with cfg; '' + path = with pkgs; [ curl ] + ++ optional cfg.pdfExport texLiveFull + ++ optional (cfg.repositoryType == "darcs") darcs + ++ optional (cfg.repositoryType == "mercurial") mercurial + ++ optional (cfg.repositoryType == "git") git; + + preStart = let + gm = "gitit@${config.networking.hostName}"; + in + with cfg; '' chown ${uid}:${gid} -R ${homeDir} for dir in ${repositoryPath} ${staticDir} ${templatesDir} ${cacheDir} do @@ -637,14 +642,35 @@ in fi done cd ${repositoryPath} - if [ ! -d .git ] - then - ${pkgs.git}/bin/git init - ${pkgs.git}/bin/git config user.email "gitit@${config.networking.hostName}" - ${pkgs.git}/bin/git config user.name "gitit" - chown ${uid}:${gid} -R {repositoryPath} - fi - cd - + ${ + if repositoryType == "darcs" then + '' + if [ ! -d _darcs ] + then + ${pkgs.darcs}/bin/darcs initialize + echo "${gm}" > _darcs/prefs/email + '' + else if repositoryType == "mercurial" then + '' + if [ ! -d .hg ] + then + ${pkgs.mercurial}/bin/hg init + cat >> .hg/hgrc <<NAMED +[ui] +username = gitit ${gm} +NAMED + '' + else + '' + if [ ! -d .git ] + then + ${pkgs.git}/bin/git init + ${pkgs.git}/bin/git config user.email "${gm}" + ${pkgs.git}/bin/git config user.name "gitit" + ''} + chown ${uid}:${gid} -R ${repositoryPath} + fi + cd - ''; serviceConfig = { |