Add --pure to nix-shell calls

This commit is contained in:
Pedro Pombeiro 2019-04-12 14:45:54 +02:00
parent 0fb9cabcfc
commit a7f8252d50
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
5 changed files with 11 additions and 6 deletions

View File

@ -39,7 +39,7 @@ pipeline {
steps {
sh """
nix build -v --no-link &&
nix-shell --run echo
nix-shell --pure --run echo
"""
}
}

View File

@ -40,7 +40,7 @@ pipeline {
sh """
. ~/.nix-profile/etc/profile.d/nix.sh && \
nix build -v --no-link && \
nix-shell --run echo
nix-shell --pure --run echo
"""
}
}

View File

@ -88,7 +88,7 @@ RUN export USER=jenkins \
&& /tmp/nix-install.sh \
&& . ~/.nix-profile/etc/profile.d/nix.sh \
&& nix-build --no-out-link https://github.com/status-im/status-react/tarball/${GIT_COMMIT} \
&& nix-shell --run 'echo' https://github.com/status-im/status-react/tarball/${GIT_COMMIT}
&& nix-shell --pure --run 'echo' https://github.com/status-im/status-react/tarball/${GIT_COMMIT}
# hack to avoid calling login
ENV USER=jenkins

View File

@ -16,12 +16,15 @@ def getToolVersion(name) {
}
def nix_sh(cmd) {
def isPure = env.TARGET_PLATFORM == 'linux'
def pureFlag = isPure ? '--pure' : ''
sh """
set +x
. ~/.nix-profile/etc/profile.d/nix.sh
set -x
nix-shell --argstr target-os \'${env.TARGET_PLATFORM}\' \\
--run \'${cmd}\' \\
${pureFlag} --run \'${cmd}\' \\
\'${env.WORKSPACE}/shell.nix\'
"""
}

View File

@ -22,10 +22,12 @@ if ! command -v "nix" >/dev/null 2>&1; then
fi
if command -v "nix" >/dev/null 2>&1; then
echo -e "${GREEN}Configuring Nix shell for target '${TARGET_OS:=all}'...${NC}";
echo -e "${GREEN}Configuring Nix shell for target '${TARGET_OS:=all}'...${NC}"
if [[ $@ == "ENTER_NIX_SHELL" ]]; then
exec nix-shell --show-trace --argstr target-os ${TARGET_OS}
else
exec nix-shell --show-trace --argstr target-os ${TARGET_OS} --run "$@"
is_pure=''
[ "${TARGET_OS}" == 'linux' ] && is_pure='--pure'
exec nix-shell ${is_pure} --show-trace --argstr target-os ${TARGET_OS} --run "$@"
fi
fi