summary refs log tree commit diff
path: root/lib/customisation.nix
Commit message (Collapse)AuthorAge
* lib.callPackages(With): guard against a repeated mistakeVladimír Čunát2020-03-12
| | | | For example see the parent commit.
* Merge pull request #67809 from Infinisil/propagate-override-argsSilvan Mosberger2019-10-22
|\ | | | | lib.makeOverridable: Propagate function arguments
| * lib/makeOverridable: RefactorSilvan Mosberger2019-09-05
| | | | | | | | | | | | | | - Rename ff to result because that's what it is - Better indentation - Less parens - Comment what overrideWith does
| * lib/makeOverridable: Remove unimplemented overrideDerivation for functionsSilvan Mosberger2019-09-05
| | | | | | | | | | | | - Apparently nobody ever needed this - We already have enough ways to override things - Using overrideDerivation is discouraged
| * lib/makeOverridable: Propagate function args of the callPackage'd functionSilvan Mosberger2019-09-05
| | | | | | | | | | | | | | This allows querying function arguments of things like fetchFromGitHub: nix-repl> lib.functionArgs pkgs.fetchFromGitHub { fetchSubmodules = true; githubBase = true; ... }
| * lib/makeOverridable: Propagate function arguments to override functionsSilvan Mosberger2019-09-05
| | | | | | | | | | | | | | This allows querying the arguments you can .override: nix-repl> lib.functionArgs pkgs.hello.override { fetchurl = false; stdenv = false; }
| * lib/makeOverridable: Abstract result overridingSilvan Mosberger2019-09-05
| |
| * lib/makeOverridable: Deduplicate override definitionSilvan Mosberger2019-09-05
| | | | | | | | And call it overrideArgs in the let binding because that's what it does
* | Fix typo in customisation.nixGabriel Féron2019-09-02
|/
* lib: tiny cleanupJan Malakhovski2019-02-03
|
* lib: fix wording of the `overrideScope` warningBas van Dijk2018-10-11
|
* lib: Make `overrideScope'` which takes arguments in the conventional orderJohn Ericson2018-09-24
| | | | | | | | | | | | | | | | | | 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.
* lib: Use lib.fixed-points.extends to avoid repetitionJohn Ericson2018-08-20
| | | | | | | | | | | | | | | 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.
* [bot] treewide: remove unused 'inherit' in let blocksvolth2018-07-20
|
* Revert "lib: Use lib.fixed-points.extends to avoid repetition"Silvan Mosberger2018-07-12
| | | | This reverts commit 48ccdf322d9e7a68d0caf5833511ee3e53ec7d3a.
* lib: Use lib.fixed-points.extends to avoid repetitionJohn Ericson2018-07-09
|
* lib.addPassthru: removed as scheduledVladimír Čunát2018-03-03
|
* Add setFunctionArgs lib function.Shea Levy2018-01-31
| | | | | | Among other things, this will allow *2nix tools to output plain data while still being composable with the traditional callPackage/.override interfaces.
* addPassthru: fix argument orderOrivej Desh2018-01-24
| | | | | | 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.
* lib: deprecate `addPassthru`Jan Malakhovski2018-01-14
|
* treewide: replace `addPassthru`Jan Malakhovski2018-01-14
|
* lib: change the order of arguments of `addPassthru`Jan Malakhovski2018-01-14
|
* lib: generalize `addPassthru` to `extendDerivation`Jan Malakhovski2018-01-03
|
* Revert "Merge branch 'improved-make-overridable' of ↵Shea Levy2017-09-29
| | | | | | | git://github.com/ElvishJerricco/nixpkgs" This reverts commit c3af1210b4c5d7ef380e75add463b37574fdcc8b, reversing changes made to 49f175cd0c80a39e1d05fc687c4a2a40e0aba58c.
* Revert "Avoid polluting lib namespace unncessarily"Shea Levy2017-09-29
| | | | | | Reverting #27319 This reverts commit 01a3f0b8aabdb321b15dc7cc0e2287ce8232f797.
* Avoid polluting lib namespace unncessarilyShea Levy2017-09-28
|
* Merge branch 'improved-make-overridable' of ↵Shea Levy2017-09-28
|\ | | | | | | git://github.com/ElvishJerricco/nixpkgs
| * Added `self` views of the interface in `makeExtensibleWithInterface`Will Fancher2017-07-14
| | | | | | | | Fixing the `overrideScope` in `haskellpackages`.
| * Added `overrideScope` for `callPackageWith`Will Fancher2017-07-13
| | | | | | | | Consequently removing several ad-hoc definitions of the same concept.
| * Re-added `overrideAttrs` in `makeOverridable`Will Fancher2017-07-12
| |
| * Added `callPackageWithSelfWith` and `callPackageWithSelf`Will Fancher2017-07-12
| |
| * Improved `makeOverridable` with `extend` and `overridePackage`Will Fancher2017-07-12
| |
* | Convert libs to a fixed-pointGraham Christensen2017-09-16
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 )
* stdenv: add stawman docs for `makeOverridable`Gleb Peregud2017-06-24
| | | | Also fix a typo in docs in haskell-modules.
* lib.makeScope: sync comment after rename in #25285Vladimír Čunát2017-04-30
|
* makeScope: prevent name collision with makeOverridableThomas Tuegel2017-04-28
|
* lib: trivial spelling fixesTom Saeger2017-04-19
|
* lib.makeScope: Save package set functionThomas Tuegel2017-02-27
|
* add .overrideDerivation and .overrideAttrs to packages created with ↵danbst2017-02-12
| | | | | | | | | `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.
* ~/.nixpkgs -> ~/.config/nixpkgsEelco Dolstra2017-02-01
| | | | | | The former is still respected as a fallback for config.nix for backwards compatibility (but not for overlays because they're a new feature).
* mkDerivation: add overrideAttrs functionAneesh Agrawal2016-10-02
| | | | | | | | | 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.
* nixos systemPackages: rework default outputsVladimír Čunát2016-01-28
| | | | | | | | | | | - 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.
* lib: add makeScopeThomas Tuegel2015-09-27
|
* Add function callPackagesWithEelco Dolstra2015-07-28
| | | | | | 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.
* Remove deepOverrideEelco Dolstra2015-07-28
| | | | | | | | 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.
* Revert "Refactor mkFlag / shouldUsePkg into the nixpkgs libraries"Eelco Dolstra2015-06-04
| | | | This reverts commit 25a148fa196b944b3f134527da87e43d88c066f9.
* Refactor mkFlag / shouldUsePkg into the nixpkgs librariesWilliam A. Kennington III2015-05-22
|
* lib: cleanup a little bit, add traceIfJan Malakhovski2015-03-26
|
* Rename scrubDrv -> hydraJob and make it more effectiveEelco Dolstra2015-03-20
| | | | | | | | | 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.
* Revert "Revert "mkOverridable: Use functors to allow overridable functions""Shea Levy2015-01-13
| | | | | | | Original commit was reverted due to using features from a newer nix than hydra had, hydra has since been updated This reverts commit 07e726c85c8f36d3a27fb7254f09ac69c7b94c65.