Packaging/Python: Difference between revisions

imported>Milahu
m wording
imported>Adisbladis
Line 22: Line 22:
For a local working python environment you can use the following <code>shell.nix</code><ref>https://groups.google.com/forum/#!topic/nix-devel/3qPfwCAV3GE</ref>.
For a local working python environment you can use the following <code>shell.nix</code><ref>https://groups.google.com/forum/#!topic/nix-devel/3qPfwCAV3GE</ref>.
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
with import <nixpkgs> {};
{ pkgs ? import <nixpkgs> { } }:


stdenv.mkDerivation {
let
   name = "pip-env";
   pythonEnv = pkgs.python3.withPackages(ps: [
  buildInputs = [
     ps.requests
     # System requirements.
  ]);
    readline


    # Python requirements (enough to get a virtualenv going).
in
    python27Full
pkgs.mkShell {
     python27Packages.virtualenv
  packages = [
    python27Packages.pip
     pythonEnv
   ];
   ];
  src = null;
  shellHook = ''
    # Allow the use of wheels.
    SOURCE_DATE_EPOCH=$(date +%s)
    # Augment the dynamic linker path
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${R}/lib/R/lib:${readline}/lib
  '';
}
}
</syntaxHighlight>
</syntaxHighlight>