sourcehut: fix logging of git/hg ssh commands

Signed-off-by: Christoph Heiss <christoph@c8h4.io>

+41 -4
+13 -4
nixos/modules/services/misc/sourcehut/default.nix
··· 801 801 ''; 802 802 }; 803 803 systemd.services.sshd = { 804 - #path = optional cfg.git.enable [ cfg.git.package ]; 804 + preStart = concatStringsSep "\n" ( 805 + optionals cfg.git.enable (map (n: '' 806 + touch /var/log/sourcehut/gitsrht-${n} # create if it does not exist yet 807 + chown --silent ${cfg.git.user}:${cfg.git.group} /var/log/sourcehut/gitsrht-${n} || true 808 + '') [ 809 + "keys" 810 + "shell" 811 + "update-hook" 812 + ]) ++ 813 + optional cfg.hg.enable [ 814 + "chown ${cfg.hg.user}:${cfg.hg.group} /var/log/sourcehut/hgsrht-keys" 815 + ]); 805 816 serviceConfig = { 806 - BindPaths = optionals cfg.git.enable [ 807 - "/var/log:/var/log" 808 - ]; 817 + LogsDirectory = mkIf (cfg.git.enable || cfg.hg.enable) "sourcehut"; 809 818 BindReadOnlyPaths = 810 819 # Note that those /usr/bin/* paths are hardcoded in multiple places in *.sr.ht, 811 820 # for instance to get the user from the [git.sr.ht::dispatch] settings.
+20
pkgs/applications/version-management/sourcehut/git.nix
··· 31 31 pname = "gitsrht-dispatch"; 32 32 modRoot = "gitsrht-dispatch"; 33 33 vendorHash = "sha256-EDvSZ3/g0xDSohrsAIpNhk+F0yy8tbnTW/3tURTonMc="; 34 + 35 + postPatch = '' 36 + substituteInPlace gitsrht-dispatch/main.go \ 37 + --replace /var/log/gitsrht-dispatch /var/log/sourcehut/gitsrht-dispatch 38 + ''; 34 39 }; 35 40 36 41 gitKeys = buildGoModule { ··· 38 43 pname = "gitsrht-keys"; 39 44 modRoot = "gitsrht-keys"; 40 45 vendorHash = "sha256-9pojS69HCKVHUceyOpGtv9ewcxFD4WsOVsEzkmWJkF4="; 46 + 47 + postPatch = '' 48 + substituteInPlace gitsrht-keys/main.go \ 49 + --replace /var/log/gitsrht-keys /var/log/sourcehut/gitsrht-keys 50 + ''; 41 51 }; 42 52 43 53 gitShell = buildGoModule { ··· 45 55 pname = "gitsrht-shell"; 46 56 modRoot = "gitsrht-shell"; 47 57 vendorHash = "sha256-WqfvSPuVsOHA//86u33atMfeA11+DJhjLmWy8Ivq0NI="; 58 + 59 + postPatch = '' 60 + substituteInPlace gitsrht-shell/main.go \ 61 + --replace /var/log/gitsrht-shell /var/log/sourcehut/gitsrht-shell 62 + ''; 48 63 }; 49 64 50 65 gitUpdateHook = buildGoModule { ··· 52 67 pname = "gitsrht-update-hook"; 53 68 modRoot = "gitsrht-update-hook"; 54 69 vendorHash = "sha256-Bc3yPabS2S+qiroHFKrtkII/CfzBDYQ6xWxKHAME+Tc="; 70 + 71 + postPatch = '' 72 + substituteInPlace gitsrht-update-hook/main.go \ 73 + --replace /var/log/gitsrht-update-hook /var/log/sourcehut/gitsrht-update-hook 74 + ''; 55 75 }; 56 76 57 77 in
+8
pkgs/applications/version-management/sourcehut/hg.nix
··· 25 25 postPatch = '' 26 26 substituteInPlace Makefile \ 27 27 --replace "all: api hgsrht-keys" "" 28 + 29 + substituteInPlace hgsrht-shell \ 30 + --replace /var/log/hgsrht-shell /var/log/sourcehut/hgsrht-shell 28 31 ''; 29 32 30 33 hgsrht-api = buildGoModule ({ ··· 39 42 pname = "hgsrht-keys"; 40 43 modRoot = "hgsrht-keys"; 41 44 vendorHash = "sha256-7ti8xCjSrxsslF7/1X/GY4FDl+69hPL4UwCDfjxmJLU="; 45 + 46 + postPatch = '' 47 + substituteInPlace hgsrht-keys/main.go \ 48 + --replace /var/log/hgsrht-keys /var/log/sourcehut/hgsrht-keys 49 + ''; 42 50 }; 43 51 44 52 propagatedBuildInputs = [