From 66cc5c7ef9cae94f41dd52860a69911be33112e6 Mon Sep 17 00:00:00 2001 From: cab Date: Mon, 22 Aug 2022 11:40:41 +0400 Subject: [PATCH] git-sync: add ssh to path This fixes automated pushing to repository. --- .github/CODEOWNERS | 2 +- modules/services/git-sync.nix | 3 ++- tests/modules/services/git-sync/basic.nix | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 51bea0ec7..9d1ae31aa 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -345,7 +345,7 @@ Makefile @thiagokokada /modules/services/fnott.nix @polykernel /tests/modules/services/fnott @polykernel -/modules/services/git-sync.nix @IvanMalison +/modules/services/git-sync.nix @IvanMalison @cab404 /modules/services/gnome-keyring.nix @rycee diff --git a/modules/services/git-sync.nix b/modules/services/git-sync.nix index 07a792712..42f8c4cc3 100644 --- a/modules/services/git-sync.nix +++ b/modules/services/git-sync.nix @@ -13,6 +13,7 @@ let Service = { Environment = [ + "PATH=${lib.makeBinPath (with pkgs; [ openssh git ])}" "GIT_SYNC_DIRECTORY=${repo.path}" "GIT_SYNC_COMMAND=${cfg.package}/bin/git-sync" "GIT_SYNC_REPOSITORY=${repo.uri}" @@ -65,7 +66,7 @@ let }); in { - meta.maintainers = [ maintainers.imalison ]; + meta.maintainers = [ maintainers.imalison maintainers.cab404 ]; options = { services.git-sync = { diff --git a/tests/modules/services/git-sync/basic.nix b/tests/modules/services/git-sync/basic.nix index 0e9c7ad65..ff0cb78b7 100644 --- a/tests/modules/services/git-sync/basic.nix +++ b/tests/modules/services/git-sync/basic.nix @@ -11,16 +11,24 @@ }; }; + test.stubs = { + git = { name = "git"; }; + openssh = { name = "openssh"; }; + }; + nmt.script = '' serviceFile=home-files/.config/systemd/user/git-sync-test.service assertFileExists $serviceFile + + serviceFile=$(normalizeStorePaths $serviceFile) assertFileContent $serviceFile ${ builtins.toFile "expected" '' [Install] WantedBy=default.target [Service] + Environment=PATH=/nix/store/00000000000000000000000000000000-openssh/bin:/nix/store/00000000000000000000000000000000-git/bin 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