Skip to content

Instantly share code, notes, and snippets.

@vakili
Created May 24, 2021 11:10
Show Gist options
  • Save vakili/a7c6a73dc2bbedefaee970d9a86ee630 to your computer and use it in GitHub Desktop.
Save vakili/a7c6a73dc2bbedefaee970d9a86ee630 to your computer and use it in GitHub Desktop.
Python development environment
# first run the following
# $ niv init
# $ niv update nixpkgs -b nixpkgs-unstable
# then enter the environment by running
# $ nix-shell
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs { };
inherit (pkgs.lib) optional optionals;
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
# ref = "refs/tags/3.2.0";
ref = "refs/heads/conda-beta";
}) {
condaChannelsExtra.conda-forge = [
(builtins.fetchurl "https://conda.anaconda.org/conda-forge/linux-64/repodata.json")
(builtins.fetchurl "https://conda.anaconda.org/conda-forge/noarch/repodata.json")
]; };
customPython = mach-nix.mkPython {
requirements = ''
numpy
faiss-cpu
scikit-learn
'';
providers = {
_default = "conda-forge,wheel,sdist,nixpkgs";
scikitlearn = "conda-forge";
faiss-cpu = "wheel";
};
};
in pkgs.mkShell {
buildInputs = with pkgs;
[ customPython
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment