Skip to content

Instantly share code, notes, and snippets.

@ghedamat
Created June 3, 2020 18:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ghedamat/fbba4433579cd6ef8fdd94c5da57fbb3 to your computer and use it in GitHub Desktop.
Save ghedamat/fbba4433579cd6ef8fdd94c5da57fbb3 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
let
my-python-packages = python-packages: with python-packages; [
pip
setuptools
];
python-with-my-packages = pkgs.python3.withPackages my-python-packages;
# define packages to install with special handling for OSX
basePackages = [
gnumake
gcc
readline
openssl
zlib
libxml2
curl
libiconv
elixir_1_9
glibcLocales
nodejs-12_x
yarn
postgresql
inotify-tools
python-with-my-packages
];
inputs = if pkgs.system == "x86_64-darwin" then
basePackages ++ [ pkgs.darwin.apple_sdk.frameworks.CoreServices ]
else
basePackages;
# define shell startup command
hooks = ''
export PS1='\n\[\033[1;32m\][nix-shell:\w]($(git rev-parse --abbrev-ref HEAD))\$\[\033[0m\] '
# this allows python to work locally
alias pip="PIP_PREFIX='$(pwd)/_build/pip_packages' \pip"
export PYTHONPATH="$(pwd)/_build/pip_packages/lib/python3.7/site-packages:$PYTHONPATH"
unset SOURCE_DATE_EPOCH
# this allows mix to work on the local directory
mkdir -p .nix-mix
mkdir -p .nix-hex
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
export PATH=$MIX_HOME/bin:$PATH
export PATH=$HEX_HOME/bin:$PATH
export LANG=en_US.UTF-8
export PATH=$PATH:$(pwd)/_build/pip_packages/bin
export ERL_AFLAGS="-kernel shell_history enabled"
'';
in pkgs.stdenv.mkDerivation {
name = "elixir-19-shell";
buildInputs = inputs;
shellHook = hooks;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment