summaryrefslogtreecommitdiff
path: root/lib/customisation.nix (follow)
Commit message (Expand)AuthorAgeFilesLines
* WIP: treewide: splice more nested package sets•••So far this just has some functions that might come in handy. Next step is to find package sets that provide things used as non-buildInputs (most of them seem to not fit that?). I've always hated this splicing monster. Maybe others can tell me where this might be worth it. CC @FRidh @globin origin/wip/splice-moreJohn Ericson2020-11-291-0/+1
* lib: Create `makeScopeWithSplicing`•••It's ugly as hell, but I suppose it is needed to codify how to make spliced package sets. John Ericson2020-11-191-0/+27
* lib.callPackages(With): guard against a repeated mistake•••For example see the parent commit. Vladimír Čunát2020-03-121-1/+6
* Merge pull request #67809 from Infinisil/propagate-override-args•••lib.makeOverridable: Propagate function argumentsSilvan Mosberger2019-10-221-14/+23
|\
| * lib/makeOverridable: Refactor•••- Rename ff to result because that's what it is - Better indentation - Less parens - Comment what overrideWith does Silvan Mosberger2019-09-051-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 Mosberger2019-09-051-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 Mosberger2019-09-051-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 Mosberger2019-09-051-2/+4
| * lib/makeOverridable: Abstract result overridingSilvan Mosberger2019-09-051-3/+4
| * lib/makeOverridable: Deduplicate override definition•••And call it overrideArgs in the let binding because that's what it does Silvan Mosberger2019-09-051-2/+5
* | Fix typo in customisation.nixGabriel Féron2019-09-021-1/+1
|/
* lib: tiny cleanupJan Malakhovski2019-02-031-1/+1
* lib: fix wording of the `overrideScope` warningBas van Dijk2018-10-111-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 Ericson2018-09-241-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 Ericson2018-08-201-1/+2
* [bot] treewide: remove unused 'inherit' in let blocksvolth2018-07-201-5/+0
* Revert "lib: Use lib.fixed-points.extends to avoid repetition"•••This reverts commit 48ccdf322d9e7a68d0caf5833511ee3e53ec7d3a. Silvan Mosberger2018-07-121-1/+1
* lib: Use lib.fixed-points.extends to avoid repetitionJohn Ericson2018-07-091-1/+1
* lib.addPassthru: removed as scheduledVladimír Čunát2018-03-031-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 Levy2018-01-311-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 Desh2018-01-241-2/+3
* lib: deprecate `addPassthru`Jan Malakhovski2018-01-141-1/+2
* treewide: replace `addPassthru`Jan Malakhovski2018-01-141-1/+1
* lib: change the order of arguments of `addPassthru`Jan Malakhovski2018-01-141-2/+2
* lib: generalize `addPassthru` to `extendDerivation`Jan Malakhovski2018-01-031-4/+13
* Revert "Merge branch 'improved-make-overridable' of git://github.com/ElvishJe...•••This reverts commit c3af1210b4c5d7ef380e75add463b37574fdcc8b, reversing changes made to 49f175cd0c80a39e1d05fc687c4a2a40e0aba58c. Shea Levy2017-09-291-137/+27
* Revert "Avoid polluting lib namespace unncessarily"•••Reverting #27319 This reverts commit 01a3f0b8aabdb321b15dc7cc0e2287ce8232f797. Shea Levy2017-09-291-1/+1
* Avoid polluting lib namespace unncessarilyShea Levy2017-09-281-1/+1
* Merge branch 'improved-make-overridable' of git://github.com/ElvishJerricco/n...Shea Levy2017-09-281-27/+137
|\
| * Added `self` views of the interface in `makeExtensibleWithInterface`•••Fixing the `overrideScope` in `haskellpackages`. Will Fancher2017-07-141-27/+24
| * Added `overrideScope` for `callPackageWith`•••Consequently removing several ad-hoc definitions of the same concept. Will Fancher2017-07-131-16/+48
| * Re-added `overrideAttrs` in `makeOverridable`Will Fancher2017-07-121-0/+5
| * Added `callPackageWithSelfWith` and `callPackageWithSelf`Will Fancher2017-07-121-0/+9
| * Improved `makeOverridable` with `extend` and `overridePackage`Will Fancher2017-07-121-24/+91
* | Convert libs to a fixed-point•••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 ) Graham Christensen2017-09-161-1/+1
|/
* stdenv: add stawman docs for `makeOverridable`•••Also fix a typo in docs in haskell-modules. Gleb Peregud2017-06-241-0/+18
* lib.makeScope: sync comment after rename in #25285Vladimír Čunát2017-04-301-1/+1
* makeScope: prevent name collision with makeOverridableThomas Tuegel2017-04-281-1/+1
* lib: trivial spelling fixesTom Saeger2017-04-191-1/+1
* lib.makeScope: Save package set functionThomas Tuegel2017-02-271-3/+4
* add .overrideDerivation and .overrideAttrs to packages created with `callPack...•••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. danbst2017-02-121-5/+3
* ~/.nixpkgs -> ~/.config/nixpkgs•••The former is still respected as a fallback for config.nix for backwards compatibility (but not for overlays because they're a new feature). Eelco Dolstra2017-02-011-4/+4
* mkDerivation: add overrideAttrs function•••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. Aneesh Agrawal2016-10-021-10/+12
* nixos systemPackages: rework default outputs•••- 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. Vladimír Čunát2016-01-281-1/+1
* lib: add makeScopeThomas Tuegel2015-09-271-0/+19
* Add function callPackagesWith•••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. Eelco Dolstra2015-07-281-2/+20
* Remove deepOverride•••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. Eelco Dolstra2015-07-281-12/+0
* Revert "Refactor mkFlag / shouldUsePkg into the nixpkgs libraries"•••This reverts commit 25a148fa196b944b3f134527da87e43d88c066f9. Eelco Dolstra2015-06-041-23/+0
* Refactor mkFlag / shouldUsePkg into the nixpkgs librariesWilliam A. Kennington III2015-05-221-0/+23
* lib: cleanup a little bit, add traceIfJan Malakhovski2015-03-261-8/+9