From df1f22c1228d965579c7511435e7d2114d9bd6cb Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 2 Dec 2020 13:38:43 +0100 Subject: [PATCH] develop: support for srun --- garlic/develop.nix | 5 ++++- overlay.nix | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/garlic/develop.nix b/garlic/develop.nix index 1873e9e..9861f61 100644 --- a/garlic/develop.nix +++ b/garlic/develop.nix @@ -33,10 +33,13 @@ stdenv.mkDerivation { export TEMP=/tmp export LANG=en_US.UTF-8 - export TERM=linux source ${stdenv}/setup + # Access to bin and nix tools for srun, as it keeps the PATH + export "PATH=\$PATH:/bin" + export "PATH=$PATH:/gpfs/projects/bsc15/nix/bin" + if [[ -z "\$@" ]]; then exec ${bashInteractive}/bin/bash else diff --git a/overlay.nix b/overlay.nix index a86077e..f4cb0fe 100644 --- a/overlay.nix +++ b/overlay.nix @@ -198,7 +198,7 @@ let ]; }; - develop = bsc.garlic.stages.exec { + develop = bsc.garlic.stages.exec rec { nextStage = bsc.garlic.stages.isolate { nextStage = bsc.garlic.unsafeDevelop; nixPrefix = bsc.garlic.targetMachine.config.nixPrefix; @@ -206,9 +206,15 @@ let }; nixPrefix = bsc.garlic.targetMachine.config.nixPrefix; # This hack uploads all dependencies to MN4 - pre = '' + pre = let + nixPrefix = bsc.garlic.targetMachine.config.nixPrefix; + stageProgram = bsc.garlicTools.stageProgram; + in + '' # Hack to upload this to MN4: @upload-to-mn@ - # Run the following command in a normal interactive shell (outside nix) + + # Create a link to the develop script + ln -fs ${nixPrefix}${stageProgram nextStage} .nix-develop ''; post = "\n"; };