Prerequisites
wgetis installedtaris installed
Purpose
If you really don't want to install Nix under /nix (or you can't) then you can install Nix in your home directory like in the homedir_install.sh script included in this Gist.
Now whenever you want to run a command under Nix's control, you should prefix with nixrun.
Good luck.
homedir_install.sh
function install_nix() {
local -r bindir="${HOME}/opt/bin"
local -r proot_url="https://github.com/proot-me/proot-static-build/blob/master/static/proot-x86_64?raw=true"
local -r nixdir="${HOME}/mnt/nix"
local -r nixver="1.11.2"
local -r arch="x86_64"
local -r os="linux"
local -r nixbz2_url="http://nixos.org/releases/nix/nix-${nixver}/nix-${nixver}-${arch}-${os}.tar.bz2"
mkdir -p "${bindir}"
wget -O "${bindir}/proot" "${proot_url}"
chmod u+x "${bindir}/proot"
mkdir -p "${nixdir}"
pushd "${nixdir}"
wget "${nixbz2_url}"
tar xjf nix-*bz2
local -r nixbin="$(dirname "$(find "${nixdir}" -name "nix-shell" | head -1)")"
export PATH="${bindir}:${nixbin}:${PATH}"
{
echo "#!/usr/bin/env bash"
echo
echo "proot -b \"${nixdir}/nix-${nixver}-${arch}-${os}/:/nix\" \$@"
} > "${bindir}/nixrun"
chmod u+x "${bindir}/nixrun"
}
set -eu
set -o pipefail
install_nixUpdate: Thanks to Will Price (@willprice) for pointing out my original link to the proot static binary was broken on Oct 23, 2017: https://github.com/proot-me/proot/issues/120#issuecomment-338649213
Susan Potter
Quant
Work with me
I spent the first half of my career building risk models and market data infrastructure at BNP Paribas, Bank of America, and Citadel, then fourteen years shipping production systems at scale. Now I bring both sides to quantitative trading. If you're a trading firm, family office, or fund looking to tighten the connection between your research ideas and your production trading systems, whether that's building validation pipelines, formalizing signal logic, or getting microstructure analytics into a deployable state, I'd like to hear what you're working on. Reach me at me@susanpotter.net.