Packaging/Python: Difference between revisions
Add a section to explain how to locally test a packaged Python library |
Improve flake.nix in "Testing out a module in a Python shell" (remove need to manually spell out python deps) |
||
| Line 24: | Line 24: | ||
inputs = { | inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos- | nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; | ||
flake-utils.url = "github:numtide/flake-utils"; | flake-utils.url = "github:numtide/flake-utils"; | ||
}; | }; | ||
| Line 32: | Line 32: | ||
let | let | ||
pkgs = import nixpkgs { inherit system; }; | pkgs = import nixpkgs { inherit system; }; | ||
xacro = pkgs.python3Packages.callPackage ./derivation.nix { | |||
lib = pkgs.lib; | lib = pkgs.lib; | ||
}; | }; | ||
in { | in { | ||
devShells.default = pkgs.mkShell { | devShells.default = pkgs.mkShell { | ||
buildInputs = [ | buildInputs = [ pkgs.python3 xacro ]; | ||
}; | }; | ||
}); | }); | ||
} | } | ||
</syntaxhighlight>Replace "mypackage" with your package name | </syntaxhighlight>Replace "mypackage" with your package name. Then, enter the devShell and launch a Python REPL:<syntaxhighlight lang="shell-session"> | ||
$ nix develop | $ nix develop | ||
$ python | $ python | ||