Packaging/Python: Difference between revisions
→Testing out a module in a Python shell: Use python3.withPackages instead of a devshell |
m Fixed formatting error with note |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 33: | Line 33: | ||
pkgs = import nixpkgs { inherit system; }; | pkgs = import nixpkgs { inherit system; }; | ||
# replace ./derivation.nix with the path (relative to this file) to your derivation | # replace ./derivation.nix with the path (relative to this file) to your derivation | ||
mypackage = pkgs.python3Packages.callPackage ./derivation.nix { | |||
lib = pkgs.lib; | lib = pkgs.lib; | ||
}; | }; | ||
in { | in { | ||
packages.default = pkgs.python3.withPackages(_: [ | packages.default = pkgs.python3.withPackages(_: [ mypackage ]); | ||
}); | }); | ||
} | } | ||
| Line 49: | Line 49: | ||
== Pip and Virtualenv enabled nix-shell == | == Pip and Virtualenv enabled nix-shell == | ||
It might be the case that you simply need to prototype fast small projects with <code>pip</code> and <code>virtualenv</code> without the need for relying on the dependencies being already packaged in nixpkgs. | It might be the case that you simply need to prototype fast small projects with <code>pip</code> and <code>virtualenv</code> without the need for relying on the dependencies being already packaged in nixpkgs. | ||
{{ | |||
{{Note|Keep in mind that the virtualenv symlinks will be invalidated if you update your system!}} | |||
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>. | ||