summary refs log tree commit diff
path: root/lib/default.nix
Commit message (Collapse)AuthorAge
* lib: move assertMsg and assertOneOf to their own library fileProfpatsch2018-09-06
| | | | | Since the `assertOneOf` uses `lib.generators`, they are not really trivial anymore and should go into their own library file.
* lib/trivial: add assertOneOfProfpatsch2018-09-06
|
* lib/trivial: add assertMsgProfpatsch2018-09-06
|
* as requested:Aaron Andersen2018-08-21
| | | | | | | - moved function into strings.nix - renamed function from makePerl5Lib - removed duplicates entries in the resulting value - rewrote the function from scratch after learning a few things (much cleaner now)
* lib: bitAnd, bitOr, bitXor (bitsize-agnostic fallback function) (#41491)volth2018-06-10
| | | | | | | | | | | | * lib: bitAnd, bitOr, bitXor * lib: test for bitAnd, bitOr, bitXor * lib: bitsize-agnostic zipIntBits * lib: bitNot * lib: bitNot
* lib: add groupBy (#38612)volth2018-06-10
|
* Revert "lib: bitAnd, bitOr, bitXor"Profpatsch2018-06-05
|
* lib: bitAnd, bitOr, bitXorvolth2018-06-01
|
* lib: Add more configure flag helpersJohn Ericson2018-05-11
| | | | | Add with/without to match enable/disable, and add `--{enable,with}-key=value` versions of both.
* treewide: rename version attributesMaximilian Bosch2018-04-28
| | | | | | | | | | | | | | | As suggested in https://github.com/NixOS/nixpkgs/pull/39416#discussion_r183845745 the versioning attributes in `lib` should be consistent to `nixos/version` which implicates the following changes: * `lib.trivial.version` -> `lib.trivial.release` * `lib.trivial.suffix` -> `lib.trivial.versionSuffix` * `lib.nixpkgsVersion` -> `lib.version` As `lib.nixpkgsVersion` is referenced several times in `NixOS/nixpkgs`, `NixOS/nix` and probably several user's setups. As the rename will cause a notable impact it's better to keep `lib.nixpkgsVersion` as alias with a warning yielded by `builtins.trace`.
* lib/debug: remove the deprecated strict functionProfpatsch2018-04-27
| | | | The grace period was long enough.
* lib/debug: add traceValFn, traceValSeqFn, traceValSeqNFnProfpatsch2018-04-27
| | | | | Being able to modify the value on-the-fly before printing is very useful in practice.
* Merge pull request #38611 from volth/nat-sortJörg Thalheim2018-04-08
|\ | | | | lib: add naturalSort
| * lib: add naturalSortvolth2018-04-08
| |
* | lib: make extensibleSilvan Mosberger2018-04-07
|/ | | | | | | | | | | | | | | | | | | | | This allows the lib fixed point to be extended with myLib = lib.extend (self: super: { foo = "foo"; }) With this it's possible to have the new modified lib attrset available to all modules when using evalModules myLib.evalModules { modules = [ ({ lib, ... }: { options.bar = lib.mkOption { default = lib.foo; }; }) ]; } => { config = { bar = "foo"; ... }; options = ...; }
* Merge pull request #34444 from obsidiansystems/meta-checkJohn Ericson2018-03-18
|\ | | | | lib: Fix #30902
| * lib, stdenv: Check `meta.platforms` against host platform and be open worldJohn Ericson2018-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, we need check against the host platform, not the build platform. That's simple enough. Second, we move away from exahustive finite case analysis (i.e. exhaustively listing all platforms the package builds on). That only work in a closed-world setting, where we know all platforms we might build one. But with cross compilation, we may be building for arbitrary platforms, So we need fancier filters. This is the closed world to open world change. The solution is instead of having a list of systems (strings in the form "foo-bar"), we have a list of of systems or "patterns", i.e. attributes that partially match the output of the parsers in `lib.systems.parse`. The "check meta" logic treats the systems strings as an exact whitelist just as before, but treats the patterns as a fuzzy whitelist, intersecting the actual `hostPlatform` with the pattern and then checking for equality. (This is done using `matchAttrs`). The default convenience lists for `meta.platforms` are now changed to be lists of patterns (usually a single pattern) in `lib/systems/for-meta.nix` for maximum flexibility under this new system. Fixes #30902
* | rename lib/maintainers-list.nix into maintainers/maintainer-list.nixJan Malakhovski2018-03-06
|/ | | | | | Many commits unrelated to `lib` touch that file, this will make `git log ./lib` much saner. This is what I meant in https://github.com/NixOS/nixpkgs/pull/36119#issuecomment-370184101.
* Merge pull request #36168 from ryantm/majorminorJörg Thalheim2018-03-04
|\ | | | | a single version attribute for expressions previously using "majorVersion"
| * lib: add versions libraryRyan Mulligan2018-03-04
| |
* | Revert "Revert "Convert maintainer file entries to attributes, add github ↵Graham Christensen2018-03-04
| | | | | | | | handles""
* | Revert "Convert maintainer file entries to attributes, add github handles"Graham Christensen2018-03-03
| | | | | | | | This reverts commit aa47bac04f06aeea993dc2e2cc6649fde4f31ed7.
* | Revert "lib/maintainers: rename file to maintainers-list.nix"Graham Christensen2018-03-03
| | | | | | | | This reverts commit 24684008df7b7c748eeca64de1270a0e6c460a61.
* | lib/maintainers: rename file to maintainers-list.nixProfpatsch2018-03-04
| | | | | | | | | | | | Based on a request by @oxij: “Can we also rename this file to `maintainers/maintainers-list.nix` while we at this? Motivation: much saner `git log ./lib`.”
* | Convert maintainer file entries to attributes, add github handlesProfpatsch2018-03-04
|/ | | | | | | | | | | | | Based on https://github.com/NixOS/nixpkgs/pull/34842, the nix-instantiate output was pretty-printed and the validity of the github handles manually verified, by automatically checking whether the user handles exist on github (https://github.com/userhandle, status 200 or 404). Each handle under 5 characters was manually checked (because the collision probability with non-maintainer accounts is high), each missing entry was manually researched. The script used is kept in `maintainers/scripts` as an example of how to work with the mainainers list through nix’ JSON interface.
* lib.addPassthru: removed as scheduledVladimír Čunát2018-03-03
|
* lib: implement `compare`, `splitByAndCompare`, and `compareLists`Jan Malakhovski2018-02-09
|
* 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.
* Merge #33057: stdenv meta checks: make them lazyVladimír Čunát2018-01-14
|\ | | | | | | | | Closes #22277 - it's superseded; I have some WIP on evaluation performance, but best do that in a separate PR/thread.
| * lib: generalize `addPassthru` to `extendDerivation`Jan Malakhovski2018-01-03
| |
* | callCabal2nix: Fix calling with a path in the store.Shea Levy2018-01-11
| |
* | Added `lib.cleanSourceWith` as composable version of `filterSource`Will Fancher2018-01-09
|/
* Revert "nixos: doc: implement related packages in the manual"Graham Christensen2017-12-23
|
* lib: implement `compare`, `splitByAndCompare`, and `compareLists`Jan Malakhovski2017-12-07
|
* lib: delete reference to lib/sandbox.nixOrivej Desh2017-11-19
| | | | after it was deleted in 0fe7bde3d88027977a07a24baee98d2ecc07222f
* Revert "Fix evaluation"Shea Levy2017-09-29
| | | | | | Reverting #27319 This reverts commit 751d397ad486a84b93907345124f550e3b32427c.
* Revert "Fix tarball"Shea Levy2017-09-29
| | | | | | Reverting #27319 This reverts commit 9ce7175cfe9edf5f7eb9a9f299807047a4feeaf1.
* Revert "Avoid polluting lib namespace unncessarily"Shea Levy2017-09-29
| | | | | | Reverting #27319 This reverts commit 01a3f0b8aabdb321b15dc7cc0e2287ce8232f797.
* Avoid polluting lib namespace unncessarilyShea Levy2017-09-28
|
* Fix tarballShea Levy2017-09-28
|
* Fix evaluationShea Levy2017-09-28
|
* 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 )
* lib: Move fixed-point combinators out of trivialJohn Ericson2017-05-29
| | | | | Trivia != prelude. This is a better organized and less likely to scare off new contributors.
* Merge pull request #24610 from Ericson2314/platform-normalizationJohn Ericson2017-04-17
|\ | | | | Platform normalization
| * lib: Collect system/platform related filesJohn Ericson2017-04-17
| | | | | | | | Previously, platforms was a random thing in top-level
* | /lib/default.nix: Add file docstring & unit test hintProfpatsch2017-04-12
|/
* Add locateDominatingFile lib functionShea Levy2017-03-04
|
* lib: add ini configuration generatorProfpatsch2016-11-17
| | | | | | | Many configurations are INI-style files. Attribute sets can be mapped rather painlessly to the INI format. This adds a function toINI inside a new generators library section. Also, unit tests for the default values are provided.
* lib/fetchers.nix: factor out impure proxy vars (#18702)Profpatsch2016-09-17
| | | | Apparently everyone just copied those variables, instead of creating a library constant for them. Some even removed the comment. -.-
* lib/default.nix: reorder imports for clarityProfpatsch2016-09-15
| | | | | Group imports according to the kind of functions they contain, in a more descriptive manner.