2022-09-05 13:51:03 +02:00
|
|
|
{ config, ... }:
|
2021-07-15 03:20:28 +02:00
|
|
|
|
|
|
|
{
|
2022-09-05 13:51:03 +02:00
|
|
|
services.git-sync = {
|
|
|
|
enable = true;
|
|
|
|
package = config.lib.test.mkStubPackage { outPath = "@git-sync@"; };
|
|
|
|
repositories.test = {
|
|
|
|
path = "/a/path";
|
|
|
|
uri = "git+ssh://user@example.com:/~user/path/to/repo.git";
|
2021-07-15 03:20:28 +02:00
|
|
|
};
|
2022-09-05 13:51:03 +02:00
|
|
|
};
|
2021-07-15 03:20:28 +02:00
|
|
|
|
2023-04-15 16:43:40 +02:00
|
|
|
test.stubs.openssh = { name = "openssh"; };
|
2022-08-22 09:40:41 +02:00
|
|
|
|
2022-09-05 13:51:03 +02:00
|
|
|
nmt.script = ''
|
|
|
|
serviceFile=home-files/.config/systemd/user/git-sync-test.service
|
2021-07-15 03:20:28 +02:00
|
|
|
|
2022-09-05 13:51:03 +02:00
|
|
|
assertFileExists $serviceFile
|
2022-08-22 09:40:41 +02:00
|
|
|
|
2022-09-05 13:51:03 +02:00
|
|
|
serviceFile=$(normalizeStorePaths $serviceFile)
|
|
|
|
assertFileContent $serviceFile ${
|
|
|
|
builtins.toFile "expected" ''
|
|
|
|
[Install]
|
|
|
|
WantedBy=default.target
|
2021-07-15 03:20:28 +02:00
|
|
|
|
2022-09-05 13:51:03 +02:00
|
|
|
[Service]
|
2023-06-02 13:14:53 +02:00
|
|
|
Environment=PATH=@openssh@/bin:/nix/store/00000000000000000000000000000000-git/bin
|
2022-09-05 13:51:03 +02:00
|
|
|
Environment=GIT_SYNC_DIRECTORY=/a/path
|
|
|
|
Environment=GIT_SYNC_COMMAND=@git-sync@/bin/git-sync
|
2024-10-31 21:55:36 +01:00
|
|
|
Environment=GIT_SYNC_REPOSITORY='git+ssh://user@example.com:/~user/path/to/repo.git'
|
2022-09-05 13:51:03 +02:00
|
|
|
Environment=GIT_SYNC_INTERVAL=500
|
|
|
|
ExecStart=@git-sync@/bin/git-sync-on-inotify
|
|
|
|
Restart=on-abort
|
2021-07-15 03:20:28 +02:00
|
|
|
|
2022-09-05 13:51:03 +02:00
|
|
|
[Unit]
|
|
|
|
Description=Git Sync test
|
|
|
|
''
|
|
|
|
}
|
|
|
|
'';
|
2021-07-15 03:20:28 +02:00
|
|
|
}
|