forked from mirrors/nixpkgs
nixos: gitit service, add all different repo initalizers
This commit is contained in:
parent
1e2d3f3b5f
commit
727e2b5237
|
@ -19,9 +19,6 @@ let
|
||||||
in writeScript "gitit" ''
|
in writeScript "gitit" ''
|
||||||
#!${stdenv.shell}
|
#!${stdenv.shell}
|
||||||
cd $HOME
|
cd $HOME
|
||||||
export PATH="${makeSearchPath "bin" (
|
|
||||||
[ git curl ] ++ (if cfg.pdfExport then [texLiveFull] else [])
|
|
||||||
)}:$PATH";
|
|
||||||
export NIX_GHC="${env}/bin/ghc"
|
export NIX_GHC="${env}/bin/ghc"
|
||||||
export NIX_GHCPKG="${env}/bin/ghc-pkg"
|
export NIX_GHCPKG="${env}/bin/ghc-pkg"
|
||||||
export NIX_GHC_DOCDIR="${env}/share/doc/ghc/html"
|
export NIX_GHC_DOCDIR="${env}/share/doc/ghc/html"
|
||||||
|
@ -624,8 +621,16 @@ in
|
||||||
description = "Git and Pandoc Powered Wiki";
|
description = "Git and Pandoc Powered Wiki";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
path = with pkgs; [ curl ]
|
||||||
|
++ optional cfg.pdfExport texLiveFull
|
||||||
|
++ optional (cfg.repositoryType == "darcs") darcs
|
||||||
|
++ optional (cfg.repositoryType == "mercurial") mercurial
|
||||||
|
++ optional (cfg.repositoryType == "git") git;
|
||||||
|
|
||||||
preStart = with cfg; ''
|
preStart = let
|
||||||
|
gm = "gitit@${config.networking.hostName}";
|
||||||
|
in
|
||||||
|
with cfg; ''
|
||||||
chown ${uid}:${gid} -R ${homeDir}
|
chown ${uid}:${gid} -R ${homeDir}
|
||||||
for dir in ${repositoryPath} ${staticDir} ${templatesDir} ${cacheDir}
|
for dir in ${repositoryPath} ${staticDir} ${templatesDir} ${cacheDir}
|
||||||
do
|
do
|
||||||
|
@ -637,14 +642,35 @@ in
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
cd ${repositoryPath}
|
cd ${repositoryPath}
|
||||||
if [ ! -d .git ]
|
${
|
||||||
then
|
if repositoryType == "darcs" then
|
||||||
${pkgs.git}/bin/git init
|
''
|
||||||
${pkgs.git}/bin/git config user.email "gitit@${config.networking.hostName}"
|
if [ ! -d _darcs ]
|
||||||
${pkgs.git}/bin/git config user.name "gitit"
|
then
|
||||||
chown ${uid}:${gid} -R {repositoryPath}
|
${pkgs.darcs}/bin/darcs initialize
|
||||||
fi
|
echo "${gm}" > _darcs/prefs/email
|
||||||
cd -
|
''
|
||||||
|
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 = {
|
serviceConfig = {
|
||||||
|
|
Loading…
Reference in a new issue