Created
November 28, 2018 17:00
-
-
Save 71/0f14fcf523145cf457fd57251555eb9a to your computer and use it in GitHub Desktop.
Run a command in a Nix-aware PRoot environment.
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
#!/bin/bash | |
# Run the given command in a Nix-aware environment installed in | |
# '~/opt/nix', assuming PRoot is available in '~/opt/bin/proot-x86_64'. | |
# | |
# If no arguments are given, 'zsh' is executed. | |
# | |
# Note: | |
# The full path to 'nix.sh' is given instead of '~/.nix-profile/etc/profile.d/nix.sh', | |
# because in some cases, the symlink may not be property set up when running the script. | |
set -- ${1:-zsh} ${@:2:$#} | |
$HOME/opt/bin/proot-x86_64 -b $HOME/opt/nix:/nix sh <(echo "source /nix/var/nix/profiles/per-user/$USER/profile/etc/profile.d/nix.sh && $@") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment