mirror of
https://github.com/nix-community/naersk
synced 2025-02-16 11:18:23 +00:00
Add the autoCrateSpecificOverrides
option
This commit is contained in:
parent
9ffa3dac85
commit
751f21a49e
3 changed files with 21 additions and 10 deletions
|
@ -267,6 +267,7 @@ Note that you shouldn't call `overrideAttrs` on a derivation built by Naersk
|
|||
| `postInstall` | Optional hook to run after the compilation is done; inside this script, `$out/bin` contains compiled Rust binaries. Useful if your application needs e.g. custom environment variables, in which case you can simply run `wrapProgram $out/bin/your-app-name` in here. Default: `false` |
|
||||
| `usePureFromTOML` | Whether to use the `fromTOML` built-in or not. When set to `false` the python package `remarshal` is used instead (in a derivation) and the JSON output is read with `builtins.fromJSON`. This is a workaround for old versions of Nix. May be used safely from Nix 2.3 onwards where all bugs in `builtins.fromTOML` seem to have been fixed. Default: `true` |
|
||||
| `mode` | What to do when building the derivation. Either `build`, `check`, `test`, `fmt` or `clippy`. <br/> When set to something other than `build`, no binaries are generated. Default: `"build"` |
|
||||
| `autoCrateSpecificOverrides` | Whether to automatically apply crate-specific overrides, mainly additional `buildInputs` for dependencies. <br /> For example, if you use the `openssl` crate, `pkgs.pkg-config` and `pkgs.openssl` are automatically added as buildInputs. Default: `true` |
|
||||
|
||||
|
||||
### Note on `overrideAttrs`
|
||||
|
|
23
build.nix
23
build.nix
|
@ -70,6 +70,7 @@
|
|||
, userAttrs
|
||||
#| Some additional buildInputs/overrides individual crates require
|
||||
, crateSpecificOverrides
|
||||
, autoCrateSpecificOverrides
|
||||
, pkgs
|
||||
}:
|
||||
|
||||
|
@ -393,16 +394,18 @@ let
|
|||
else {}
|
||||
)
|
||||
cratesIoDependencies;
|
||||
in builtins.foldl'
|
||||
(acc: elem:
|
||||
{
|
||||
buildInputs = acc.buildInputs ++ elem.buildInputs or [];
|
||||
nativeBuildInputs = acc.nativeBuildInputs ++ elem.nativeBuildInputs or [];
|
||||
}
|
||||
)
|
||||
{ buildInputs = []; nativeBuildInputs = []; }
|
||||
overridesList;
|
||||
|
||||
emptyOverrides = { buildInputs = []; nativeBuildInputs = []; };
|
||||
in if autoCrateSpecificOverrides then
|
||||
builtins.foldl'
|
||||
(acc: elem:
|
||||
{
|
||||
buildInputs = acc.buildInputs ++ elem.buildInputs or [];
|
||||
nativeBuildInputs = acc.nativeBuildInputs ++ elem.nativeBuildInputs or [];
|
||||
}
|
||||
)
|
||||
emptyOverrides
|
||||
overridesList
|
||||
else emptyOverrides;
|
||||
|
||||
# Crates.io dependencies required to compile user's crate.
|
||||
#
|
||||
|
|
|
@ -200,6 +200,12 @@ let
|
|||
# What to do when building the derivation. Either `build`, `check`, `test`, `fmt` or `clippy`. <br/>
|
||||
# When set to something other than `build`, no binaries are generated.
|
||||
mode = attrs0.mode or "build";
|
||||
|
||||
# Whether to automatically apply crate-specific overrides, mainly additional
|
||||
# `buildInputs` for dependencies. <br />
|
||||
# For example, if you use the `openssl` crate, `pkgs.pkg-config` and
|
||||
# `pkgs.openssl` are automatically added as buildInputs.
|
||||
autoCrateSpecificOverrides = attrs0.autoCrateSpecificOverrides or true;
|
||||
};
|
||||
|
||||
argIsAttrs =
|
||||
|
@ -302,6 +308,7 @@ let
|
|||
cargoDocOptions
|
||||
copyDocsToSeparateOutput
|
||||
removeReferencesToSrcFromDocs
|
||||
autoCrateSpecificOverrides
|
||||
|
||||
postInstall
|
||||
;
|
||||
|
|
Loading…
Add table
Reference in a new issue