From ea4585da54055508b2f3f9121d080857571bf967 Mon Sep 17 00:00:00 2001 From: Adrien Devresse Date: Wed, 11 Oct 2017 17:14:26 +0200 Subject: [PATCH] Modernize the sourcethis --- bbp/viz/servus/default.nix | 4 +-- sourcethis.sh | 51 ++++++++++++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/bbp/viz/servus/default.nix b/bbp/viz/servus/default.nix index 7616a32e8c..8b5baf280a 100644 --- a/bbp/viz/servus/default.nix +++ b/bbp/viz/servus/default.nix @@ -8,8 +8,8 @@ stdenv.mkDerivation rec { src = fetchgit { url = "https://github.com/HBPVIS/Servus.git"; - rev = "8d47578a7b738432f294b12af80aa9c9d9080df0"; - sha256 = "033f2jjkfzaw66nafhgyf1qry8bjbsk3f4plzkhrdhv7hf6kgb18"; + rev = "2e9a23aa32c2fc3f5c517405b0ac6292cd09abdf"; + sha256 = "0w9ahjghs3p1yb8svzvpk2izzssigqjkcfhdxfhmzknclgv54qs6"; }; diff --git a/sourcethis.sh b/sourcethis.sh index ecd2f8c02c..25dde75410 100644 --- a/sourcethis.sh +++ b/sourcethis.sh @@ -3,23 +3,52 @@ export NIXPKG_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )" -# setup SSH for gerrit access -if [[ "${NIX_PATH}" != *"ssh-config-file"* ]]; then - export NIX_PATH="ssh-config-file=$HOME/.ssh/config:$NIX_PATH" -fi +function LocalMachineSSHSetup { -# setup SSH agent forwarding -if [[ "${SSH_AUTH_SOCK}x" != "x" ]]; then - export NIX_PATH="ssh-auth-sock=${SSH_AUTH_SOCK}:${NIX_PATH}" -fi + # setup SSH for gerrit access + if [[ "${NIX_PATH}" != *"ssh-config-file"* ]]; then + export NIX_PATH="ssh-config-file=$HOME/.ssh/config:$NIX_PATH" + fi + + + # setup SSH agent forwarding + if [[ "${SSH_AUTH_SOCK}x" != "x" ]]; then + export NIX_PATH="ssh-auth-sock=${SSH_AUTH_SOCK}:${NIX_PATH}" + fi +} + + +function vizClusterSSHSetup { + + # setup SSH for git access on viz cluster at BBP + echo "Enable BBP viz cluster configuration" + + export NIX_PATH="ssh-config-file=/etc/nix/ssh/config:$NIX_PATH" -# and setup the BBP nixpkgs" -export NIX_PATH="BBPpkgs=${NIXPKG_DIR}:${NIX_PATH}" +} + +function BBPnixpkgsSetup { + # and setup the BBP nixpkgs" + export NIX_PATH="BBPpkgs=${NIXPKG_DIR}:${NIX_PATH}" + +} + + + +BBPnixpkgsSetup + +if [[ "$(hostname)" == *viz* ]]; then + vizClusterSSHSetup +else + LocalMachineSSHSetup +fi echo "### setup NIX_PATH as" -echo "export NIX_PATH=${NIX_PATH}" +VAL_EXPORT="export NIX_PATH=${NIX_PATH}" +echo "$VAL_EXPORT" +eval "$VAL_EXPORT"