From 86fecf7db28911315f9f96070de8e689a0e69791 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Tue, 18 May 2021 17:36:09 +0300 Subject: Fix rollback to old profiles In 5d5da48 (https://github.com/serokell/deploy-rs/pull/81), $DRY_ACTIVATE is used in a bash script with -u. When DRY_ACTIVATE is not set (which it is not for older profiles), the script fails. Fix this by setting a fallback. --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index bc1ebc6..c6b3357 100644 --- a/flake.nix +++ b/flake.nix @@ -73,7 +73,7 @@ #!${pkgs.runtimeShell} set -euo pipefail - if [[ $DRY_ACTIVATE == "1" ]] + if [[ "x''${DRY_ACTIVATE:-}" == "x1" ]] then ${if builtins.hasAttr "dryActivate" customSelf then -- cgit v1.2.3 From c8854cee197e8ed73702aea60992d50fcd824811 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Tue, 18 May 2021 17:40:57 +0300 Subject: flake.nix: clean up dry-activation logic --- flake.nix | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index c6b3357..d985db3 100644 --- a/flake.nix +++ b/flake.nix @@ -73,13 +73,9 @@ #!${pkgs.runtimeShell} set -euo pipefail - if [[ "x''${DRY_ACTIVATE:-}" == "x1" ]] + if [[ "''${DRY_ACTIVATE:-}" == "1" ]] then - ${if builtins.hasAttr "dryActivate" customSelf - then - customSelf.dryActivate - else - "echo ${pkgs.writeScript "activate" activate}"} + ${customSelf.dryActivate or "echo ${pkgs.writeScript "activate" activate}"} else ${activate} fi @@ -91,7 +87,7 @@ name = base.name + "-activate-rs"; text = '' #!${pkgs.runtimeShell} - exec ${self.defaultPackage."${system}"}/bin/activate "$@" + exec ${self.defaultPackage.${system}}/bin/activate "$@" ''; executable = true; destination = "/activate-rs"; -- cgit v1.2.3