1 import ./make-test-python.nix ({ pkgs, ... }:
4 hashes = pkgs.writeText "hashes" ''
5 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c /project/bar
10 meta = with pkgs.lib.maintainers; {
11 maintainers = [ tilpner ];
17 networking.firewall.allowedTCPPorts = [ config.services.gitDaemon.port ];
19 environment.systemPackages = [ pkgs.git ];
21 systemd.tmpfiles.rules = [
22 # type path mode user group age arg
23 " d /git 0755 git git - -"
26 services.gitDaemon = {
34 environment.systemPackages = [ pkgs.git ];
41 with subtest("create project.git"):
43 "git init --bare /git/project.git",
44 "touch /git/project.git/git-daemon-export-ok",
47 with subtest("add file to project.git"):
49 "git clone /git/project.git /project",
50 "echo foo > /project/bar",
51 "git config --global user.email 'you@example.com'",
52 "git config --global user.name 'Your Name'",
53 "git -C /project add bar",
54 "git -C /project commit -m 'quux'",
55 "git -C /project push",
59 # Change user/group to default daemon user/group from module
60 # to avoid "fatal: detected dubious ownership in repository at '/git/project.git'"
61 server.succeed("chown git:git -R /git/project.git")
63 with subtest("git daemon starts"):
64 server.wait_for_unit("git-daemon.service")
67 server.systemctl("start network-online.target")
68 client.systemctl("start network-online.target")
69 server.wait_for_unit("network-online.target")
70 client.wait_for_unit("network-online.target")
72 with subtest("client can clone project.git"):
74 "git clone git://server/project.git /project",
75 "sha256sum -c ${hashes}",