summaryrefslogtreecommitdiff
path: root/lib/default.nix (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib.takeEnd: init (#398222)Johannes Kirschbauer2025-04-231-0/+1
|\
| * lib.takeEnd: initazahi2025-04-131-0/+1
| |
* | lib.strings: init splitStringByHeitor Augusto2025-04-071-0/+1
|/
* lib.modules: init lib.mkDefinitionRobert Hensing2025-04-031-0/+1
| | | | Free-floating definitions including file location.
* treewide: Format all Nix filesSilvan Mosberger2025-04-011-184/+538
| | | | | | | | | | | | | | | | | | | | | | Format all Nix files using the officially approved formatter, making the CI check introduced in the previous commit succeed: nix-build ci -A fmt.check This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153) of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166). This commit will lead to merge conflicts for a number of PRs, up to an estimated ~1100 (~33%) among the PRs with activity in the past 2 months, but that should be lower than what it would be without the previous [partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537). Merge conflicts caused by this commit can now automatically be resolved while rebasing using the [auto-rebase script](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/maintainers/scripts/auto-rebase). If you run into any problems regarding any of this, please reach out to the [formatting team](https://nixos.org/community/teams/formatting/) by pinging @NixOS/nix-formatting.
* lib.generators: alias `mkLuaInline` at the top-levelMatt Sturgeon2025-03-151-0/+1
|
* lib.strings: init toSentenceCase (#381802)Johannes Kirschbauer2025-02-201-1/+1
|\
| * lib.strings: init toSentenceCaseisabel2025-02-191-1/+1
| |
* | lib: Discourage use of extend (#376033)Robert Hensing2025-02-091-2/+34
|\ \ | |/ |/|
| * lib/default.nix: Update extend docRobert Hensing2025-01-291-0/+5
| | | | | | Co-authored-by: Johannes Kirschbauer <hsjobeki+github@gmail.com>
| * lib: Discourage use of extendRobert Hensing2025-01-231-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It creates interoperability issues that can not be reconciled by `lib` or maintainers of projects that use the Nixpkgs library. Occasionally, end users may be able to solve the problems they run into, but most are not prepared to deal with this set of problems, nor should they be. Typical conflict: - User wants to propagate their own lib, because it has some function they like to use throughout their projects - Project maintainer requires the project's lib to be used No sane language uses a single namespace for combining all the things. (Arguably not even C with its extensive use of prefixing) Meanwhile, in Nix, all symbols are first class variables. We don't even have the concept of a global top-level namespace to pour everything into. With `lib` you can try to approximate that, I get the appeal of its apparent simplicity, but since `lib` can't be global, we just don't even get that apparent simplicity. I apologize for not offering concrete solutions to this in the text. The manuals are limited to reference documentation. Alternatives - of which we have multiple - are best provided in task-oriented documentation, e.g. nix.dev.
* | lib.extendMkDerivation: initYueh-Shun Li2025-01-181-1/+2
|/ | | | | | | | | Add functions extendMkDerivation to lib.customisation. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Lin Jian <me@linj.tech> Co-authored-by: Philip Taron <philip.taron@gmail.com>
* lib.dropEnd: initRobert Hensing2025-01-031-2/+3
| | | | | | | | | Naming borrowed from Haskell - `base`: [`dropWhileEnd`] - `extra`, `mono-traversable`, ...: [`dropEnd`] [`dropEnd`]: https://hackage.haskell.org/package/mono-traversable-1.0.21.0/docs/Data-Sequences.html#v:dropEnd [`dropWhileEnd`]: https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-List.html#v:dropWhileEnd
* lib: add defaultTo (#357681)Silvan Mosberger2024-12-081-1/+1
|\
| * lib: add defaultToSimon Žlender2024-12-011-1/+1
| |
* | lib.strings.concatMapAttrsStringSep: initYueh-Shun Li2024-12-061-1/+1
| |
* | lib.derivations: add warnOnInstantiateash2024-12-021-1/+1
| |
* | lib/options: remove mdDocWolfgang Walther2024-11-221-1/+1
|/ | | | Following through on message itself.
* lib.oldestSupportedReleaseIsAtLeast: rename from bad name and deprecate ↵Robert Hensing2024-10-081-1/+1
| | | | | | | after 24.11 It seems impossible to describe this condition more concisely without making it incomprehensible.
* lib.toExtension: initYueh-Shun Li2024-09-141-1/+2
| | | | Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
* lib.meta: Minor SPDX license function improvementsSilvan Mosberger2024-08-251-1/+2
| | | | | | | - Expose `lib.licensesSpdx` - Create bindings for the needed internal functions - Mention that some SPDX licenses might be missing (in the future I hope we can autogenerate the Nixpkgs license list from some SPDX endpoint
* lib.strings: add `trim` and `trimWith`Matt Sturgeon2024-07-251-1/+1
| | | | | | | | `strings.trim` returns a copy of the string with all leading and trailing whitespace removed. `strings.trimWith` does the same thing, but calling code can decide whether to trim the start and/or end of the string.
* Merge pull request #149990 from ShamrockLee/lib-spdx-licenseSilvan Mosberger2024-07-251-1/+1
|\
| * lib.getLicenseFromSpdxIdOr: initYueh-Shun Li2024-06-301-1/+1
| | | | | | | | | | | | Add lib.meta.getLicenseFromSpdxIdOr as a variant of lib.meta.getLicenseFromSpdxId that explicitly state the default (fallback) value if there's no license matching the given SPDX ID.
* | lib: add getStaticSomeone Serge2024-07-211-1/+1
| |
* | lib: add getOutput', a nix-lang counterpart of _overrideFirstSomeone Serge2024-07-211-2/+2
| |
* | Merge pull request #318712 from woojiq/lib-network-ipv6-parserJanik2024-07-111-1/+4
|\ \ | | | | | | lib.network: add ipv6 parser
| * | lib.network: ipv6 parser from stringwoojiq2024-06-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a library function to parse and validate an IPv6 address from a string. It can parse the first two versions of an IPv6 address according to https://datatracker.ietf.org/doc/html/rfc4291#section-2.2. The third form "x:x:x:x:x:x.d.d.d.d" is not yet implemented. Optionally parser can accept prefix length (128 is default). Add shell script network.sh to test IPv6 parser functionality.
| * | lib: add fromHexStringlucasew2024-06-281-1/+1
| |/ | | | | | | Co-authored-by: lucasew <lucas59356@gmail.com>
* / lib: Expose typeOf, unsafeGetAttrPosRobert Hensing2024-07-031-1/+1
|/ | | | | | All builtins should be in mirrored in lib, for consistency, as well as control to let the Nixpkgs pin effect *subtle* improvements in behavior (such as the foldl' accumulator strictness).
* lib: Add a TODO for builtins not available in sub-librariesSilvan Mosberger2024-06-201-3/+3
|
* lib.replaceStrings: inherit from lib.stringsSilvan Mosberger2024-06-201-2/+1
|
* lib.readFile: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.genericClosure: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.pathExists: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.getAttr: inherit from lib.attrsetsSilvan Mosberger2024-06-201-2/+2
|
* lib.isString: inherit from lib.stringsSilvan Mosberger2024-06-201-2/+2
|
* lib.isList: inherit from lib.listsSilvan Mosberger2024-06-201-2/+2
|
* lib.isInt: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.isBool: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.isAttrs: inherit from lib.attrsetsSilvan Mosberger2024-06-201-2/+2
|
* lib.hasAttr: inherit from lib.attrsetsSilvan Mosberger2024-06-201-2/+2
|
* lib.elemAt: inherit from lib.listsSilvan Mosberger2024-06-201-2/+2
|
* lib.elem: inherit from lib.listsSilvan Mosberger2024-06-201-2/+2
|
* lib.deepSeq: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.sub: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.add: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.lessThan: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.seq: inherit from lib.trivialSilvan Mosberger2024-06-201-2/+2
|
* lib.listToAttrs: inherit from lib.attrsetsSilvan Mosberger2024-06-201-2/+2
|