about summary refs log tree commit diff
path: root/lib/customisation.nix
AgeCommit message (Collapse)AuthorFilesLines
2020-11-19lib: Create `makeScopeWithSplicing`John Ericson1-0/+27
It's ugly as hell, but I suppose it is needed to codify how to make spliced package sets.
2020-03-12lib.callPackages(With): guard against a repeated mistakeVladimír Čunát1-1/+6
For example see the parent commit.
2019-10-22Merge pull request #67809 from Infinisil/propagate-override-argsSilvan Mosberger1-14/+23
lib.makeOverridable: Propagate function arguments
2019-09-05lib/makeOverridable: RefactorSilvan Mosberger1-11/+14
- Rename ff to result because that's what it is - Better indentation - Less parens - Comment what overrideWith does
2019-09-05lib/makeOverridable: Remove unimplemented overrideDerivation for functionsSilvan Mosberger1-1/+0
- Apparently nobody ever needed this - We already have enough ways to override things - Using overrideDerivation is discouraged
2019-09-05lib/makeOverridable: Propagate function args of the callPackage'd functionSilvan Mosberger1-5/+6
This allows querying function arguments of things like fetchFromGitHub: nix-repl> lib.functionArgs pkgs.fetchFromGitHub { fetchSubmodules = true; githubBase = true; ... }
2019-09-05lib/makeOverridable: Propagate function arguments to override functionsSilvan Mosberger1-2/+4
This allows querying the arguments you can .override: nix-repl> lib.functionArgs pkgs.hello.override { fetchurl = false; stdenv = false; }
2019-09-05lib/makeOverridable: Abstract result overridingSilvan Mosberger1-3/+4
2019-09-05lib/makeOverridable: Deduplicate override definitionSilvan Mosberger1-2/+5
And call it overrideArgs in the let binding because that's what it does
2019-09-02Fix typo in customisation.nixGabriel Féron1-1/+1
2019-02-03lib: tiny cleanupJan Malakhovski1-1/+1
2018-10-11lib: fix wording of the `overrideScope` warningBas van Dijk1-1/+1
2018-09-24lib: Make `overrideScope'` which takes arguments in the conventional orderJohn Ericson1-5/+5
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.
2018-08-20lib: Use lib.fixed-points.extends to avoid repetitionJohn Ericson1-1/+2
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.
2018-07-20[bot] treewide: remove unused 'inherit' in let blocksvolth1-5/+0
2018-07-12Revert "lib: Use lib.fixed-points.extends to avoid repetition"Silvan Mosberger1-1/+1
This reverts commit 48ccdf322d9e7a68d0caf5833511ee3e53ec7d3a.
2018-07-09lib: Use lib.fixed-points.extends to avoid repetitionJohn Ericson1-1/+1
2018-03-03lib.addPassthru: removed as scheduledVladimír Čunát1-6/+0
2018-01-31Add setFunctionArgs lib function.Shea Levy1-7/+7
Among other things, this will allow *2nix tools to output plain data while still being composable with the traditional callPackage/.override interfaces.
2018-01-24addPassthru: fix argument orderOrivej Desh1-2/+3
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.
2018-01-14lib: deprecate `addPassthru`Jan Malakhovski1-1/+2
2018-01-14treewide: replace `addPassthru`Jan Malakhovski1-1/+1
2018-01-14lib: change the order of arguments of `addPassthru`Jan Malakhovski1-2/+2
2018-01-03lib: generalize `addPassthru` to `extendDerivation`Jan Malakhovski1-4/+13
2017-09-29Revert "Merge branch 'improved-make-overridable' of ↵Shea Levy1-137/+27
git://github.com/ElvishJerricco/nixpkgs" This reverts commit c3af1210b4c5d7ef380e75add463b37574fdcc8b, reversing changes made to 49f175cd0c80a39e1d05fc687c4a2a40e0aba58c.
2017-09-29Revert "Avoid polluting lib namespace unncessarily"Shea Levy1-1/+1
Reverting #27319 This reverts commit 01a3f0b8aabdb321b15dc7cc0e2287ce8232f797.
2017-09-28Avoid polluting lib namespace unncessarilyShea Levy1-1/+1
2017-09-28Merge branch 'improved-make-overridable' of ↵Shea Levy1-27/+137
git://github.com/ElvishJerricco/nixpkgs
2017-09-16Convert libs to a fixed-pointGraham Christensen1-1/+1
This does break the API of being able to import any lib file and get its libs, however I'm not sure people did this. I made this while exploring being able to swap out docFn with a stub in #2305, to avoid functor performance problems. I don't know if that is going to move forward (or if it is a problem or not,) but after doing all this work figured I'd put it up anyway :) Two notable advantages to this approach: 1. when a lib inherits another lib's functions, it doesn't automatically get put in to the scope of lib 2. when a lib implements a new obscure functions, it doesn't automatically get put in to the scope of lib Using the test script (later in this commit) I got the following diff on the API: + diff master fixed-lib 11764a11765,11766 > .types.defaultFunctor > .types.defaultTypeMerge 11774a11777,11778 > .types.isOptionType > .types.isType 11781a11786 > .types.mkOptionType 11788a11794 > .types.setType 11795a11802 > .types.types This means that this commit _adds_ to the API, however I can't find a way to fix these last remaining discrepancies. At least none are _removed_. Test script (run with nix-repl in the PATH): #!/bin/sh set -eux repl() { suff=${1:-} echo "(import ./lib)$suff" \ | nix-repl 2>&1 } attrs_to_check() { repl "${1:-}" \ | tr ';' $'\n' \ | grep "\.\.\." \ | cut -d' ' -f2 \ | sed -e "s/^/${1:-}./" \ | sort } summ() { repl "${1:-}" \ | tr ' ' $'\n' \ | sort \ | uniq } deep_summ() { suff="${1:-}" depth="${2:-4}" depth=$((depth - 1)) summ "$suff" for attr in $(attrs_to_check "$suff" | grep -v "types.types"); do if [ $depth -eq 0 ]; then summ "$attr" | sed -e "s/^/$attr./" else deep_summ "$attr" "$depth" | sed -e "s/^/$attr./" fi done } ( cd nixpkgs #git add . #git commit -m "Auto-commit, sorry" || true git checkout fixed-lib deep_summ > ../fixed-lib git checkout master deep_summ > ../master ) if diff master fixed-lib; then echo "SHALLOW MATCH!" fi ( cd nixpkgs git checkout fixed-lib repl .types )
2017-07-14Added `self` views of the interface in `makeExtensibleWithInterface`Will Fancher1-27/+24
Fixing the `overrideScope` in `haskellpackages`.
2017-07-13Added `overrideScope` for `callPackageWith`Will Fancher1-17/+49
Consequently removing several ad-hoc definitions of the same concept.
2017-07-12Re-added `overrideAttrs` in `makeOverridable`Will Fancher1-0/+5
2017-07-12Added `callPackageWithSelfWith` and `callPackageWithSelf`Will Fancher1-0/+9
2017-07-12Improved `makeOverridable` with `extend` and `overridePackage`Will Fancher1-24/+91
2017-06-24stdenv: add stawman docs for `makeOverridable`Gleb Peregud1-0/+18
Also fix a typo in docs in haskell-modules.
2017-04-30lib.makeScope: sync comment after rename in #25285Vladimír Čunát1-1/+1
2017-04-28makeScope: prevent name collision with makeOverridableThomas Tuegel1-1/+1
2017-04-19lib: trivial spelling fixesTom Saeger1-1/+1
2017-02-27lib.makeScope: Save package set functionThomas Tuegel1-3/+4
2017-02-12add .overrideDerivation and .overrideAttrs to packages created with ↵danbst1-5/+3
`callPackages`/`callPackagesWith` nix/nixUnstable, tomcatN and postgresqlNN use `callPackages` pattern, they have .override attribute, but lack .overrideDerivation and recent .overrideAttrs. Packages created with `callPackage` have all of those. Because .overrideDerivation function is used in public, without this we can break code when refactoring callPackage -> callPackages.
2017-02-01~/.nixpkgs -> ~/.config/nixpkgsEelco Dolstra1-4/+4
The former is still respected as a fallback for config.nix for backwards compatibility (but not for overlays because they're a new feature).
2016-10-02mkDerivation: add overrideAttrs functionAneesh Agrawal1-10/+12
This is similar to `overrideDerivation`, but overrides the arguments to `mkDerivation` instead of the underlying `derivation` call. Also update `makeOverridable` so that uses of `overrideAttrs` can be followed by `override` and `overrideDerivation`, i.e. they can be mix-and-matched.
2016-01-28nixos systemPackages: rework default outputsVladimír Čunát1-1/+1
- Now `pkg.outputUnspecified = true` but this attribute is missing in every output, so we can recognize whether the user chose or not. If (s)he didn't choose, we put `pkg.bin or pkg.out or pkg` into `systemPackages`. - `outputsToLink` is replaced by `extraOutputsToLink`. We add extra outputs *regardless* of whether the user chose anything. It's mainly meant for outputs with docs and debug symbols. - Note that as a result, some libraries will disappear from system path.
2015-09-27lib: add makeScopeThomas Tuegel1-0/+19
2015-07-28Add function callPackagesWithEelco Dolstra1-2/+20
This is like callPackageWith, except that it expects the supplied function to return a *set* of packages. It will then make the individual packages overridable.
2015-07-28Remove deepOverrideEelco Dolstra1-12/+0
It's unused, and also a bad idea: because it recursively recomputes every function argument and there is no sharing, you can get an exponential (?) blowup in evaluation time. For example, evaluating ‘linuxPackages.kernel’ takes 0.09s and ~13 MiB, but evaluating ‘linuxPackages.kernel.deepOverride {}’ takes 3.6s and ~305 MiB.
2015-06-04Revert "Refactor mkFlag / shouldUsePkg into the nixpkgs libraries"Eelco Dolstra1-23/+0
This reverts commit 25a148fa196b944b3f134527da87e43d88c066f9.
2015-05-22Refactor mkFlag / shouldUsePkg into the nixpkgs librariesWilliam A. Kennington III1-0/+23
2015-03-26lib: cleanup a little bit, add traceIfJan Malakhovski1-8/+9
2015-03-20Rename scrubDrv -> hydraJob and make it more effectiveEelco Dolstra1-0/+35
It now strictly evaluates all remaining attributes, preventing unevaluated thunks that cannot be garbage-collected. It's also applied to all jobs in Nixpkgs' release.nix. This reduces hydra-eval-jobs' memory consumption on the 14.12 release-combined jobset from 5.1 GB to 2.0 GB.