build.hacks
build.hacks.nixpkgsPrebuilt
Use a package output built by Nixpkgs Python infrastructure.
Adapts a package by:
- Stripping dependency propagation
- Throwing away shell script wrapping
- Filtering out sys.path dependency injection
This adaptation will of course break anything depending on other packages by $PATH
, as these are injected by wrappers.
Example
nixpkgsPrebuilt {
from = pkgs.python3Packages.torchWithoutCuda;
prev = prev.torch;
}
=>
«derivation /nix/store/3864g3951bkbkq5nrld5yd8jxq7ss72y-torch-2.4.1.drv»
Type
nixpkgsPrebuilt :: AttrSet -> derivation
Arguments
from : Prebuilt package to transform output from
prev : Previous pyproject.nix package to take passthru from
build.hacks.importCargoLock
Build a Cargo (Rust) package using rustPlatform.importCargoLock to fetch Rust dependencies.
Uses IFD (import-from-derivation) on non-local packages.
Example
importCargoLock {
prev = prev.cryptography;
# Lock file relative to source root
lockFile = "src/rust/Cargo.lock";
}
=>
«derivation /nix/store/g3z1zlmc0sqpd6d5ccfrx3c4w4nv5dzr-cryptography-43.0.0.drv»
Type
importCargoLock :: AttrSet -> derivation
Arguments
prev : Previous pyproject.nix package
importCargoLockArgs
: Arguments passed directly to rustPlatform.importCargoLock
function
cargoRoot : Path to Cargo source root
lockFile
: Path to Cargo.lock (defaults to ${cargoRoot}/Cargo.lock
)
doUnpack : Whether to unpack sources using an intermediate derivation
unpackDerivationArgs : Arguments passed directly to intermediate unpacker derivation (unused for path sources)
cargo : cargo derivation
rustc : rustc derivation
pkg-config : pkg-config derivation
build.hacks.toNixpkgs
Create a nixpkgs Python (buildPythonPackage) compatible package from a pyproject.nix build package.
Adapts a package by:
- Activating a wheel output, if not already enabled
- Create a package using generated wheel as input
Note: toNixpkgs is still experimental and subject to change.
Example
toNixpkgs {
inherit pythonSet;
packages = [ "requests" ];
}
=>
«lambda @ /nix/store/f05hjk9fh1m5py5j1ixzly07p4lla56x-source/build/hacks/default.nix:263:5»
Type
nixpkgsPrebuilt :: AttrSet -> derivation
Arguments
pythonSet : Pyproject.nix build Python package set
packages : List/predicate of overlay member packages