home-manager/tests/modules/services/git-sync/basic.nix

46 lines
1.3 KiB
Nix
Raw Normal View History

2021-07-15 01:20:28 +00:00
{ config, pkgs, ... }:
{
config = {
services.git-sync = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = "@git-sync@"; };
2021-07-15 01:20:28 +00:00
repositories.test = {
path = "/a/path";
uri = "git+ssh://user@example.com:/~user/path/to/repo.git";
};
};
test.stubs = {
git = { name = "git"; };
openssh = { name = "openssh"; };
};
2021-07-15 01:20:28 +00:00
nmt.script = ''
serviceFile=home-files/.config/systemd/user/git-sync-test.service
assertFileExists $serviceFile
serviceFile=$(normalizeStorePaths $serviceFile)
2021-07-15 01:20:28 +00:00
assertFileContent $serviceFile ${
builtins.toFile "expected" ''
[Install]
WantedBy=default.target
[Service]
Environment=PATH=/nix/store/00000000000000000000000000000000-openssh/bin:/nix/store/00000000000000000000000000000000-git/bin
2021-07-15 01:20:28 +00:00
Environment=GIT_SYNC_DIRECTORY=/a/path
Environment=GIT_SYNC_COMMAND=@git-sync@/bin/git-sync
Environment=GIT_SYNC_REPOSITORY=git+ssh://user@example.com:/~user/path/to/repo.git
Environment=GIT_SYNC_INTERVAL=500
ExecStart=@git-sync@/bin/git-sync-on-inotify
Restart=on-abort
[Unit]
Description=Git Sync test
''
}
'';
};
}