summary refs log tree commit diff
path: root/nixos/modules/services/misc/gitea.nix
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2019-05-22 21:17:59 -0400
committerAaron Andersen <aaron@fosslib.net>2019-06-10 20:32:35 -0400
commit7145cf224c3eb45985d9bfc483c9e13c16fdaa91 (patch)
tree8bb7d1c87b2dd6934c116dbe29bbcc10b252fba8 /nixos/modules/services/misc/gitea.nix
parent9d251d8b21229c1bc307d87e3258e90bdf0968bb (diff)
downloadnixpkgs-7145cf224c3eb45985d9bfc483c9e13c16fdaa91.tar
nixpkgs-7145cf224c3eb45985d9bfc483c9e13c16fdaa91.tar.gz
nixpkgs-7145cf224c3eb45985d9bfc483c9e13c16fdaa91.tar.bz2
nixpkgs-7145cf224c3eb45985d9bfc483c9e13c16fdaa91.tar.lz
nixpkgs-7145cf224c3eb45985d9bfc483c9e13c16fdaa91.tar.xz
nixpkgs-7145cf224c3eb45985d9bfc483c9e13c16fdaa91.tar.zst
nixpkgs-7145cf224c3eb45985d9bfc483c9e13c16fdaa91.zip
nixos/gitea: replace deprecated usage of PermissionsStartOnly
see #53852
Diffstat (limited to 'nixos/modules/services/misc/gitea.nix')
-rw-r--r--nixos/modules/services/misc/gitea.nix25
1 files changed, 9 insertions, 16 deletions
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index b3b7ec10e6e..7daa2dd0d4c 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -305,7 +305,15 @@ in
     };
 
     systemd.tmpfiles.rules = [
+      "d '${cfg.stateDir}' - ${cfg.user} gitea - -"
+      "d '${cfg.stateDir}/conf' - ${cfg.user} gitea - -"
+      "d '${cfg.stateDir}/custom/conf' - ${cfg.user} gitea - -"
+      "d '${cfg.repositoryRoot}' - ${cfg.user} gitea - -"
       "Z '${cfg.stateDir}' - ${cfg.user} gitea - -"
+
+      # If we have a folder or symlink with gitea locales, remove it
+      # And symlink the current gitea locales in place
+      "L+ '${cfg.stateDir}/conf/locale' - - - - ${gitea.out}/locale"
     ];
 
     systemd.services.gitea = {
@@ -318,12 +326,8 @@ in
         runConfig = "${cfg.stateDir}/custom/conf/app.ini";
         secretKey = "${cfg.stateDir}/custom/conf/secret_key";
       in ''
-        # Make sure that the stateDir exists, as well as the conf dir in there
-        mkdir -p ${cfg.stateDir}/conf
-
         # copy custom configuration and generate a random secret key if needed
         ${optionalString (cfg.useWizard == false) ''
-          mkdir -p ${cfg.stateDir}/custom/conf
           cp -f ${configFile} ${runConfig}
 
           if [ ! -e ${secretKey} ]; then
@@ -338,7 +342,6 @@ in
           chmod 640 ${runConfig} ${secretKey}
         ''}
 
-        mkdir -p ${cfg.repositoryRoot}
         # update all hooks' binary paths
         HOOKS=$(find ${cfg.repositoryRoot} -mindepth 4 -maxdepth 6 -type f -wholename "*git/hooks/*")
         if [ "$HOOKS" ]
@@ -348,20 +351,12 @@ in
           sed -ri 's,/nix/store/[a-z0-9.-]+/bin/bash,${pkgs.bash}/bin/bash,g' $HOOKS
           sed -ri 's,/nix/store/[a-z0-9.-]+/bin/perl,${pkgs.perl}/bin/perl,g' $HOOKS
         fi
-        # If we have a folder or symlink with gitea locales, remove it
-        if [ -e ${cfg.stateDir}/conf/locale ]
-        then
-          rm -r ${cfg.stateDir}/conf/locale
-        fi
-        # And symlink the current gitea locales in place
-        ln -s ${gitea.out}/locale ${cfg.stateDir}/conf/locale
+
         # update command option in authorized_keys
         if [ -r ${cfg.stateDir}/.ssh/authorized_keys ]
         then
           sed -ri 's,/nix/store/[a-z0-9.-]+/bin/gitea,${gitea.bin}/bin/gitea,g' ${cfg.stateDir}/.ssh/authorized_keys
         fi
-      '' + ''
-        chown ${cfg.user} -R ${cfg.stateDir}
       '';
 
       serviceConfig = {
@@ -369,7 +364,6 @@ in
         User = cfg.user;
         Group = "gitea";
         WorkingDirectory = cfg.stateDir;
-        PermissionsStartOnly = true;
         ExecStart = "${gitea.bin}/bin/gitea web";
         Restart = "always";
       };
@@ -385,7 +379,6 @@ in
       gitea = {
         description = "Gitea Service";
         home = cfg.stateDir;
-        createHome = true;
         useDefaultShell = true;
         group = "gitea";
       };