nixos/sourcehut: ensure that the repos directory exists

Fixes a bug where, if the OpenSSH server starts before the first initialization
of the git service, the SSH service fails to find the corresponding bind mount
and terminates with a 226/NAMESPACE error.
This commit is contained in:
Tomas Antonio Lopez 2024-01-04 00:00:32 +01:00
parent 195cbfc012
commit 147cc4061e
2 changed files with 15 additions and 9 deletions

View File

@ -790,13 +790,21 @@ in
'';
};
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" ])
mkMerge [
(builtins.listToAttrs (map (name: {
name = "/var/log/sourcehut/gitsrht-${name}";
value.f = {
inherit (cfg.git) user group;
mode = "0644";
};
}) [ "keys" "shell" "update-hook" ]))
{
${cfg.settings."git.sr.ht".repos}.d = {
inherit (cfg.git) user group;
mode = "0644";
};
}
]
);
systemd.services.sshd = {
preStart = mkIf cfg.hg.enable ''

View File

@ -49,8 +49,6 @@ in
''
start_all()
machine.wait_for_unit("multi-user.target")
# For some reason, OpenSSH fails to start on boot with code 226/NAMESPACE
machine.systemctl("start sshd.service")
machine.wait_for_unit("sshd.service")
with subtest("Check whether meta comes up"):