| Commit message (Expand) | Author | Age | Files | Lines |
| * | makeScopeWithSplicing: fix `makeScopeWithSplicing'` call•••makeScopeWithSplicing: fix comment
| Artturin | 2023-08-21 | 1 | -4/+4 |
| * | Merge pull request #245957 from amjoseph-nixpkgs/pr/lib/customization/makeSco... | Artturi | 2023-08-20 | 1 | -8/+21 |
| |\ |
|
| | * | lib.customisation: add uncurried form of makeScopeWithSplicing•••Deeply-curried functions are pretty error-prone in untyped languages
like Nix. This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.
Let's add a version that uses attrset-passing form, to provide some
minimal level of sanity-checking.
This also provides defaults for keep and extra (these are often
unneeded by the user).
| Adam Joseph | 2023-08-14 | 1 | -8/+21 |
| * | | lib.customisation.makeScope: Make `overrideScope` consistent with `makeScopeW...•••Right now converting `makeScope` to `makeScopeWithSplicing` is not
transparent to users and requires adding a warning for `overrideScope'`
in the set itself.
Warning and `overrideScope'` were added in 2018 b9dce11712d2bfc8cd367df5a7f737a5cec1e252 and there should be no users left after 5 years.
| Artturin | 2023-08-14 | 1 | -4/+5 |
| |/ |
|
| * | Revert "lib.customisation: uncurry makeScopeWithSplicing" | Silvan Mosberger | 2023-07-28 | 1 | -14/+8 |
| * | lib.makeScopeWithSplicing: provide default for keep,extra•••These are often unneeded by the user.
| Artturin | 2023-07-28 | 1 | -1/+9 |
| * | lib.customisation: uncurry makeScopeWithSplicing•••Deeply-curried functions are pretty error-prone in untyped languages
like Nix. This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.
Let's switch to attrset-passing form, to provide some minimal level
of sanity-checking.
| Adam Joseph | 2023-07-27 | 1 | -8/+6 |
| * | splice.nix: finish nativeDrv,crossDrv removal | Artturin | 2023-06-22 | 1 | -6/+0 |
| * | lib/customisation: callPackageWith should abort with errors•••ofborg relies on the behavior that existed prior to
1c00bf394867b07ed7a908408d8bc1d0afd9fa49, where evaluation would
immediately abort due to a missing argument (whether it be an aliased
package when `allowAliases = false;` or a typo'd or otherwise
nonexistent package).
If `callPackageWith` `throw`s instead of `abort`s, the following
`nix-env` invocation does not fail fast but instead silently skips the
attribute (assuming there is a package that has an aliased package in
its `autoArgs`):
$ nix-env -qa --json --file . --arg config '{ allowAliases = false; }' &>/dev/null
$ echo $?
0
This does change the error output when there is a missing package (for
any of the reasons mentioned above), though. Before this change, the
errors looked like this:
$ nix-build -A hello --arg config '{ allowAliases = false; }'
error:
… while calling the 'throw' builtin
at /home/vin/workspace/vcs/nixpkgs/master/lib/customisation.nix:179:65:
178|
179| in if missingArgs == [] then makeOverridable f allArgs else throw error;
| ^
180|
error: Function called without required argument "bash_5" at /home/vin/workspace/vcs/nixpkgs/master/pkgs/applications/misc/hello/default.nix:8, did you mean "bash" or "bashdb"?
And the errors now look like this:
$ nix-build -A hello --arg config '{ allowAliases = false; }'
error:
… while calling the 'abort' builtin
at /home/vin/workspace/vcs/nixpkgs/master/lib/customisation.nix:179:65:
178|
179| in if missingArgs == [] then makeOverridable f allArgs else abort error;
| ^
180|
error: evaluation aborted with the following error message: 'Function called without required argument "bash_5" at /home/vin/workspace/vcs/nixpkgs/master/pkgs/applications/misc/hello/default.nix:8, did you mean "bash" or "bashdb"?'
| Cole Helbling | 2023-03-24 | 1 | -1/+1 |
| * | Merge pull request #211685 from Artturin/splicingstuff1-split | Artturi | 2023-02-03 | 1 | -1/+8 |
| |\ |
|
| | * | lib.extendDerivation: Fix interaction between output selection and overrideAttrs | Robert Hensing | 2023-01-20 | 1 | -1/+8 |
| * | | lib.hydraJob: Tolerate null•••By allowing null, we allow code to avoid filterAttrs, improving
laziness in real world use cases.
Specifically, this strategy prevents infinite recursion errors,
performance issues and possibly other errors that are unrelated to
the user's code.
| Robert Hensing | 2023-01-30 | 1 | -1/+2 |
| |/ |
|
| * | lib: Fix mismatched quotes in `lib.*` doc comments•••caused problems for automated rich text generation such as
https://teu5us.github.io/nix-lib.html#customisation-functions
| YoshiRulz | 2023-01-02 | 1 | -11/+11 |
| * | lib/customisation.overrideDerivation: propagate evaluation condition•••The new derivation should evaluate only if the old derivation does.
Sadly this means that the old derivation cannot depend on the new one
any more, which was used by xorgserver on Darwin. But this is not a
problem as `overrideAttrs` can (and should) usually be used instead.
This change allowed catching an invalid `meta.platforms` in the linux_rpi
kernels, which use `overrideDerivation`.
| Naïm Favier | 2023-01-01 | 1 | -1/+9 |
| * | splice.nix: start deprecating nativeDrv and crossDrv | Artturin | 2022-11-19 | 1 | -0/+1 |
| * | lib.overrideDerivation: override attrs in __spliced | Artturin | 2022-11-18 | 1 | -6/+8 |
| * | lib/customization: Improve callPackage error message for missing args•••This uses the levenshtein distance to look through all possible
arguments to find ones that are close to what was requested:
error: Function in /home/infinisil/src/nixpkgs/pkgs/tools/text/ripgrep/default.nix
called without required argument "fetchFromGithub",
did you mean "fetchFromGitHub" or "fetchFromGitLab"?
With https://github.com/NixOS/nix/pull/3468 (in current nixUnstable) the error
message becomes even better, adding line location info
| Silvan Mosberger | 2022-04-01 | 1 | -2/+49 |
| * | lib: make extendDerivation lighter on eval•••the fix to extendDerivation in #140051 unwittingly worsened eval performance by
quite a bit. set elements alone needed over 1GB extra after the change, which
seems disproportionate to how small it was. if we flip the logic used to
determine which outputs to install around and keep a "this one exactly" flag in
the specific outputs instead of a "all of them" in the root we can avoid most
of that cost.
| pennae | 2021-10-15 | 1 | -3/+2 |
| * | fix nested calls to extendDerivation•••if extendDerivation is called on something that already had extendDerivation
called on it (eg a mkDerivation result) the second call will set
outputUnspecified=true on every output by way of propagating attributes of the
full derivation to the individual outputs. this in turn causes buildEnv--and
thus nix-shell and environment.systemPackages--to install every output of such a
derivation even when only a specific output was requested, which renders the
point of multiple outputs moot. this happens in python modules (see #139756),
though it seems that tcl and possibly others should also be affected.
| pennae | 2021-09-30 | 1 | -1/+2 |
| * | treewide: Do a number of no-op cleanups for cross and darwin•••I am taking the non-invasive parts of #110914 to hopefully help out with #111988.
In particular:
- Use `lib.makeScopeWithSplicing` to make the `darwin` package set have
a proper `callPackage`.
- Adjust Darwin `stdenv`'s overlays keeping things from the previous
stage to not stick around too much.
- Expose `binutilsNoLibc` / `darwin.binutilsNoLibc` to hopefully get us
closer to a unified LLVM and GCC bootstrap.
| John Ericson | 2021-05-06 | 1 | -3/+5 |
| * | lib: Create `makeScopeWithSplicing`•••It's ugly as hell, but I suppose it is needed to codify how to make
spliced package sets.
| John Ericson | 2020-11-19 | 1 | -0/+27 |
| * | lib.callPackages(With): guard against a repeated mistake•••For example see the parent commit.
| Vladimír Čunát | 2020-03-12 | 1 | -1/+6 |
| * | Merge pull request #67809 from Infinisil/propagate-override-args•••lib.makeOverridable: Propagate function arguments | Silvan Mosberger | 2019-10-22 | 1 | -14/+23 |
| |\ |
|
| | * | lib/makeOverridable: Refactor•••- Rename ff to result because that's what it is
- Better indentation
- Less parens
- Comment what overrideWith does
| Silvan Mosberger | 2019-09-05 | 1 | -11/+14 |
| | * | lib/makeOverridable: Remove unimplemented overrideDerivation for functions•••- Apparently nobody ever needed this
- We already have enough ways to override things
- Using overrideDerivation is discouraged
| Silvan Mosberger | 2019-09-05 | 1 | -1/+0 |
| | * | lib/makeOverridable: Propagate function args of the callPackage'd function•••This allows querying function arguments of things like fetchFromGitHub:
nix-repl> lib.functionArgs pkgs.fetchFromGitHub
{ fetchSubmodules = true; githubBase = true; ... }
| Silvan Mosberger | 2019-09-05 | 1 | -5/+6 |
| | * | lib/makeOverridable: Propagate function arguments to override functions•••This allows querying the arguments you can .override:
nix-repl> lib.functionArgs pkgs.hello.override
{ fetchurl = false; stdenv = false; }
| Silvan Mosberger | 2019-09-05 | 1 | -2/+4 |
| | * | lib/makeOverridable: Abstract result overriding | Silvan Mosberger | 2019-09-05 | 1 | -3/+4 |
| | * | lib/makeOverridable: Deduplicate override definition•••And call it overrideArgs in the let binding because that's what it does
| Silvan Mosberger | 2019-09-05 | 1 | -2/+5 |
| * | | Fix typo in customisation.nix | Gabriel Féron | 2019-09-02 | 1 | -1/+1 |
| |/ |
|
| * | lib: tiny cleanup | Jan Malakhovski | 2019-02-03 | 1 | -1/+1 |
| * | lib: fix wording of the `overrideScope` warning | Bas van Dijk | 2018-10-11 | 1 | -1/+1 |
| * | lib: Make `overrideScope'` which takes arguments in the conventional order•••The `overrideScope` bound by `makeScope` (via special `callPackage`)
took an override in the form `super: self { … }`. But this is
dangerously close to the `self: super { … }` form used by *everything*
else, even other definitions of `overrideScope`! Since that
implementation did not even share any code either until I changed it
recently in 3cf43547f4be03d1d6eb0bbfc557e2dbc13b4095, this inconsistency
is almost certainly an oversight and not intentional.
Unfortunately, just as the inconstency is hard to debug if one just
assumes the conventional order, any sudden fix would break existing
overrides in the same hard-to-debug way. So instead of changing the
definition a new `overrideScope'` with the conventional order is added,
and old `overrideScope` deprecated with a warning saying to use
`overrideScope'` instead. That will hopefully get people to stop using
`overrideScope`, freeing our hand to change or remove it in the future.
| John Ericson | 2018-09-24 | 1 | -5/+5 |
| * | lib: Use lib.fixed-points.extends to avoid repetition•••Another attempt after my sloppy https://github.com/NixOS/nixpkgs/commit/48ccdf322d9e7a68d0caf5833511ee3e53ec7d3a.
@Infinisil, thanks again, reverted in https://github.com/NixOS/nixpkgs/commit/4794aa5de233b5bf2d1c3245946379699d023467 and explained my mistakes in https://github.com/NixOS/nixpkgs/commit/48ccdf322d9e7a68d0caf5833511ee3e53ec7d3a#commitcomment-29678643. I start with their work and provide this proof of this commit's correctness:
```nix
(lib.fixedPoints.extends (lib.flip g) f) # now
((f: rattrs: self: let super = rattrs self; in super // f self super) (lib.flip g) f) # inline extends
(self: let super = f self; in super // (lib.flip g) self super) # beta reduce
(self: let super = f self; in super // g super self) # beta reduce
(self_: let super = f self_; in super // g super self_) # alpha rename
(self_: let super = f self_; in super // g super self_) # original, same
```
Eventually we might harmonize `overrideScope`'s `g` parameter with the general pattern, but I leave that breaking change as a separate step. Best not to refactor and break at once, and at least the abstractions make the oddity clearer. | John Ericson | 2018-08-20 | 1 | -1/+2 |
| * | [bot] treewide: remove unused 'inherit' in let blocks | volth | 2018-07-20 | 1 | -5/+0 |
| * | Revert "lib: Use lib.fixed-points.extends to avoid repetition"•••This reverts commit 48ccdf322d9e7a68d0caf5833511ee3e53ec7d3a.
| Silvan Mosberger | 2018-07-12 | 1 | -1/+1 |
| * | lib: Use lib.fixed-points.extends to avoid repetition | John Ericson | 2018-07-09 | 1 | -1/+1 |
| * | lib.addPassthru: removed as scheduled | Vladimír Čunát | 2018-03-03 | 1 | -6/+0 |
| * | Add setFunctionArgs lib function.•••Among other things, this will allow *2nix tools to output plain data
while still being composable with the traditional
callPackage/.override interfaces.
| Shea Levy | 2018-01-31 | 1 | -7/+7 |
| * | addPassthru: fix argument order•••addPassthru became unused in #33057, but its signature was changed at the same
time. This commit restores the original signature and updates the warning and
the changelog.
| Orivej Desh | 2018-01-24 | 1 | -2/+3 |
| * | lib: deprecate `addPassthru` | Jan Malakhovski | 2018-01-14 | 1 | -1/+2 |
| * | treewide: replace `addPassthru` | Jan Malakhovski | 2018-01-14 | 1 | -1/+1 |
| * | lib: change the order of arguments of `addPassthru` | Jan Malakhovski | 2018-01-14 | 1 | -2/+2 |
| * | lib: generalize `addPassthru` to `extendDerivation` | Jan Malakhovski | 2018-01-03 | 1 | -4/+13 |
| * | Revert "Merge branch 'improved-make-overridable' of git://github.com/ElvishJe...•••This reverts commit c3af1210b4c5d7ef380e75add463b37574fdcc8b, reversing
changes made to 49f175cd0c80a39e1d05fc687c4a2a40e0aba58c.
| Shea Levy | 2017-09-29 | 1 | -137/+27 |
| * | Revert "Avoid polluting lib namespace unncessarily"•••Reverting #27319
This reverts commit 01a3f0b8aabdb321b15dc7cc0e2287ce8232f797.
| Shea Levy | 2017-09-29 | 1 | -1/+1 |
| * | Avoid polluting lib namespace unncessarily | Shea Levy | 2017-09-28 | 1 | -1/+1 |
| * | Merge branch 'improved-make-overridable' of git://github.com/ElvishJerricco/n... | Shea Levy | 2017-09-28 | 1 | -27/+137 |
| |\ |
|
| | * | Added `self` views of the interface in `makeExtensibleWithInterface`•••Fixing the `overrideScope` in `haskellpackages`.
| Will Fancher | 2017-07-14 | 1 | -27/+24 |
| | * | Added `overrideScope` for `callPackageWith`•••Consequently removing several ad-hoc definitions of the same concept.
| Will Fancher | 2017-07-13 | 1 | -16/+48 |