nixos/tests/gitdaemon: deflake by using systemd-tmpfiles

git-daemon won't start up if its project directory (here /git) doesn't
exist. If we try to create it using the test harness, then we're racing
whether we manage to connect to the backdoor vs. the startup speed of
git-daemon.

Instead, use systemd-tmpfiles, which is guaranteed(?) to run before
network.target and thus before git-daemon.service starts.

Changed files
+5 -1
nixos
+5 -1
nixos/tests/gitdaemon.nix
···
environment.systemPackages = [ pkgs.git ];
+
systemd.tmpfiles.rules = [
+
# type path mode user group age arg
+
" d /git 0755 root root - -"
+
];
+
services.gitDaemon = {
enable = true;
basePath = "/git";
···
with subtest("create project.git"):
server.succeed(
-
"mkdir /git",
"git init --bare /git/project.git",
"touch /git/project.git/git-daemon-export-ok",
)