diff options
author | Christoph Heiss <christoph@c8h4.io> | 2023-11-11 13:49:35 +0100 |
---|---|---|
committer | Christoph Heiss <christoph@c8h4.io> | 2023-11-11 14:14:59 +0100 |
commit | acd21dad52d61370abd384b45eb8233ca3b7b4af (patch) | |
tree | 733b02bb05251f4fa14a254c03f10ac5d21bd483 | |
parent | 79dc7c3c101f9b18c8ff3da4f5c5ecba05092528 (diff) | |
download | nixlib-acd21dad52d61370abd384b45eb8233ca3b7b4af.tar nixlib-acd21dad52d61370abd384b45eb8233ca3b7b4af.tar.gz nixlib-acd21dad52d61370abd384b45eb8233ca3b7b4af.tar.bz2 nixlib-acd21dad52d61370abd384b45eb8233ca3b7b4af.tar.lz nixlib-acd21dad52d61370abd384b45eb8233ca3b7b4af.tar.xz nixlib-acd21dad52d61370abd384b45eb8233ca3b7b4af.tar.zst nixlib-acd21dad52d61370abd384b45eb8233ca3b7b4af.zip |
sourcehut: use systemd.tmpfiles instead of manually creating logfiles
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
-rw-r--r-- | nixos/modules/services/misc/sourcehut/default.nix | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/nixos/modules/services/misc/sourcehut/default.nix b/nixos/modules/services/misc/sourcehut/default.nix index a375b8eafe24..f2b09f4bc4b6 100644 --- a/nixos/modules/services/misc/sourcehut/default.nix +++ b/nixos/modules/services/misc/sourcehut/default.nix @@ -793,19 +793,19 @@ in ${pkgs.sourcehut.gitsrht}/bin/gitsrht-dispatch "$@" ''; }; + systemd.tmpfiles.settings."10-sourcehut-gitsrht" = mkIf cfg.git.enable ( + builtins.listToAttrs (map (name: { + name = "/var/log/sourcehut/gitsrht-${name}"; + value.f = { + inherit (cfg.git) user group; + mode = "0644"; + }; + }) [ "keys" "shell" "update-hook" ]) + ); systemd.services.sshd = { - preStart = concatStringsSep "\n" ( - optionals cfg.git.enable (map (n: '' - touch /var/log/sourcehut/gitsrht-${n} # create if it does not exist yet - chown --silent ${cfg.git.user}:${cfg.git.group} /var/log/sourcehut/gitsrht-${n} || true - '') [ - "keys" - "shell" - "update-hook" - ]) ++ - optional cfg.hg.enable [ - "chown ${cfg.hg.user}:${cfg.hg.group} /var/log/sourcehut/hgsrht-keys" - ]); + preStart = mkIf cfg.hg.enable '' + chown ${cfg.hg.user}:${cfg.hg.group} /var/log/sourcehut/hgsrht-keys + ''; serviceConfig = { LogsDirectory = "sourcehut"; BindReadOnlyPaths = |