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