From 147cc4061eed12dc418ec753def00a1f9544fc23 Mon Sep 17 00:00:00 2001 From: Tomas Antonio Lopez Date: Thu, 4 Jan 2024 00:00:32 +0100 Subject: [PATCH] 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. --- .../services/misc/sourcehut/default.nix | 22 +++++++++++++------ nixos/tests/sourcehut/git.nix | 2 -- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/nixos/modules/services/misc/sourcehut/default.nix b/nixos/modules/services/misc/sourcehut/default.nix index aa803d3bb693..f002635d0bb3 100644 --- a/nixos/modules/services/misc/sourcehut/default.nix +++ b/nixos/modules/services/misc/sourcehut/default.nix @@ -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 '' diff --git a/nixos/tests/sourcehut/git.nix b/nixos/tests/sourcehut/git.nix index cb3ca57ddf62..ed184d5d5518 100644 --- a/nixos/tests/sourcehut/git.nix +++ b/nixos/tests/sourcehut/git.nix @@ -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"):