set PATH once

This commit is contained in:
Motiejus Jakštys 2023-07-30 09:01:27 +03:00
parent c99adbbaa1
commit 7a224096ba
1 changed files with 9 additions and 12 deletions

View File

@ -45,29 +45,26 @@
deployDerivationsStr = builtins.concatStringsSep " " deployDerivations; deployDerivationsStr = builtins.concatStringsSep " " deployDerivations;
in '' in ''
set -x set -x
OLD_PATH=$PATH export PATH=$PATH:${pkgs.git}/bin:${pkgs.openssh}/bin:${pkgs.nix}/bin
export GIT_SSH_COMMAND="${pkgs.openssh}/bin/ssh -i ''${CREDENTIALS_DIRECTORY}/ssh-key"
export GIT_SSH_COMMAND="ssh -i ''${CREDENTIALS_DIRECTORY}/ssh-key"
if [[ ! -d config ]]; then if [[ ! -d config ]]; then
${pkgs.git}/bin/git clone ${repo} config git clone ${repo} config
cd config cd config
else else
cd config cd config
${pkgs.git}/bin/git fetch origin git fetch origin
${pkgs.git}/bin/git reset --hard origin/main git reset --hard origin/main
fi fi
export PATH=$PATH:${pkgs.git}/bin nix flake update --accept-flake-config --commit-lock-file
${pkgs.nix}/bin/nix flake update --accept-flake-config --commit-lock-file
export PATH=$OLD_PATH
export PATH=$PATH:${pkgs.git}/bin:${pkgs.openssh}/bin:${pkgs.nix}/bin nix run .#deploy-rs -- \
${pkgs.nix}/bin/nix run .#deploy-rs -- \
--ssh-opts="-i ''${CREDENTIALS_DIRECTORY}/ssh-key" \ --ssh-opts="-i ''${CREDENTIALS_DIRECTORY}/ssh-key" \
--ssh-user=deployerbot-follower \ --ssh-user=deployerbot-follower \
--targets ${deployDerivationsStr} --targets ${deployDerivationsStr}
export PATH=$OLD_PATH
exec ${pkgs.git}/bin/git push origin main git push origin main
''; '';
}; };