Skip to content

Instantly share code, notes, and snippets.

@alexhrescale
Created June 17, 2019 21:13
Show Gist options
  • Save alexhrescale/9cc9d7e755d0fda3ed32c9159cedbe81 to your computer and use it in GitHub Desktop.
Save alexhrescale/9cc9d7e755d0fda3ed32c9159cedbe81 to your computer and use it in GitHub Desktop.
conda nix expression based on v4.3.31 in nixpkgs (force install)
# ref: http://www.jaakkoluttinen.fi/blog/conda-on-nixos/
# ref: https://github.com/NixOS/nixpkgs/blob/af9d10a91b5ef0518ee12b220470735076974210/pkgs/tools/package-management/conda/default.nix
with import <nixpkgs> {};
let
condaDeps = [ stdenv.cc xorg.libSM xorg.libICE xorg.libXrender libselinux ];
extraPkgs = [ which ];
python_version = "2";
conda_version = "4.6.14";
src = fetchurl {
url = "https://repo.continuum.io/miniconda/Miniconda${python_version}-${conda_version}-Linux-x86_64.sh";
# nix-prefetch-url <path-to-installer.sh>
sha256 = "0kbgvjm8ca23d35n32srz3ys6c6aj25idg9hxr2lqahsz9d4481y";
};
installationPath = "$HOME/.conda";
conda = runCommand "conda-install" { buildInputs = [ makeWrapper ]; }
''
chmod +x ${src}
mkdir -p $out
${src} -b -u -p $out/.conda
'';
in
(buildFHSUserEnv {
name = "conda";
targetPkgs = pkgs: (builtins.concatLists [ [ conda ] condaDeps extraPkgs ]);
profile = ''
# Add conda to PATH
export CONDAHOME=${conda}/.conda
export PATH=$CONDAHOME/bin:$PATH
# Paths for gcc if compiling some C sources with pip
export NIX_CFLAGS_COMPILE="-I$CONDAHOME/include"
export NIX_CFLAGS_LINK="-L$CONDAHOME/lib"
# Some other required environment variables
export FONTCONFIG_FILE=/etc/fonts/fonts.conf
export QTCOMPOSE=${xorg.libX11}/share/X11/locale
'';
meta = {
description = "Conda is a package manager for Python";
homepage = https://conda.io/;
platforms = lib.platforms.linux;
license = lib.licenses.bsd3;
# this is derived from the conda expression in nixpkgs
# maintainers = with lib.maintainers; [ jluttine bhipple ];
};
runScript = "conda";
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment