Last active
March 29, 2021 15:02
-
-
Save dramforever/b249b7b7f09376cb88e70b7c6e7c88d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
nix build --no-link "$@" nixpkgs#stdenv | |
stdenv="$(nix eval --raw nixpkgs\#stdenv)" | |
store="$(nix eval --raw --expr builtins.storeDir)" | |
bashPath="$(dirname "$(realpath "$(type -p bash)")")" | |
exec bash --rcfile /proc/self/fd/19 19<<END | |
declare -x NIX_BUILD_TOP="$(pwd)" | |
declare -x NIX_STORE="$store" | |
declare -x out="/var/empty" | |
declare -x buildInputs="$(for i in "$@"; do nix eval --raw "$i"; echo -n ' '; done)" | |
export savedPath="\$PATH" | |
source "$stdenv"/setup | |
unset NIX_ENFORCE_PURITY | |
export PATH="$bashPath:\$PATH:\$savedPath" | |
[ -f ~/.bashrc ] && source ~/.bashrc | |
set +e | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment