Commit Graph

240 Commits

Author SHA1 Message Date
Yueh-Shun Li
11c20cd390 lib.toExtension: init
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-09-14 20:56:47 +08:00
Silvan Mosberger
f55a4b99ef lib.meta: Minor SPDX license function improvements
- 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
2024-08-25 00:57:44 +02:00
Matt Sturgeon
aad87c2aa8
lib.strings: add trim and trimWith
`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.
2024-07-25 23:43:33 +01:00
Silvan Mosberger
7c6692836e
Merge pull request #149990 from ShamrockLee/lib-spdx-license 2024-07-25 22:27:10 +02:00
Someone Serge
98384afab5 lib: add getStatic 2024-07-21 11:38:04 +00:00
Someone Serge
744305bce4 lib: add getOutput', a nix-lang counterpart of _overrideFirst 2024-07-21 11:29:23 +00:00
Janik
c20399ea2e
Merge pull request #318712 from woojiq/lib-network-ipv6-parser
lib.network: add ipv6 parser
2024-07-11 20:57:53 +02:00
Robert Hensing
fed26baf1e lib: Expose typeOf, unsafeGetAttrPos
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).
2024-07-03 11:16:31 +02:00
Yueh-Shun Li
10d2e6c906 lib.getLicenseFromSpdxIdOr: init
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.
2024-06-30 02:59:58 +08:00
woojiq
d559eed93a lib.network: ipv6 parser from string
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 "xxx: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.
2024-06-29 10:02:00 +03:00
lucasew
52cc703bba lib: add fromHexString
Co-authored-by: lucasew <lucas59356@gmail.com>
2024-06-28 20:53:53 +03:00
Silvan Mosberger
5d892a8ea5 lib: Add a TODO for builtins not available in sub-libraries 2024-06-20 22:48:55 +02:00
Silvan Mosberger
1e4f04d4d6 lib.replaceStrings: inherit from lib.strings 2024-06-20 22:48:54 +02:00
Silvan Mosberger
d3c09b9327 lib.readFile: inherit from lib.trivial 2024-06-20 22:48:54 +02:00
Silvan Mosberger
e3b0f46af9 lib.genericClosure: inherit from lib.trivial 2024-06-20 22:48:54 +02:00
Silvan Mosberger
e3faf23ba6 lib.pathExists: inherit from lib.trivial 2024-06-20 22:48:54 +02:00
Silvan Mosberger
574611fe0b lib.getAttr: inherit from lib.attrsets 2024-06-20 22:48:53 +02:00
Silvan Mosberger
94a863973a lib.isString: inherit from lib.strings 2024-06-20 22:48:04 +02:00
Silvan Mosberger
6f7324c1f0 lib.isList: inherit from lib.lists 2024-06-20 22:48:04 +02:00
Silvan Mosberger
fa82e813f1 lib.isInt: inherit from lib.trivial 2024-06-20 22:48:04 +02:00
Silvan Mosberger
5313a054d3 lib.isBool: inherit from lib.trivial 2024-06-20 22:48:04 +02:00
Silvan Mosberger
53744d55cd lib.isAttrs: inherit from lib.attrsets 2024-06-20 22:48:02 +02:00
Silvan Mosberger
c3b87461e7 lib.hasAttr: inherit from lib.attrsets 2024-06-20 22:47:33 +02:00
Silvan Mosberger
4bcc1d3450 lib.elemAt: inherit from lib.lists 2024-06-20 22:47:01 +02:00
Silvan Mosberger
46b7bbb660 lib.elem: inherit from lib.lists 2024-06-20 22:47:01 +02:00
Silvan Mosberger
f341dca2a2 lib.deepSeq: inherit from lib.trivial 2024-06-20 22:47:01 +02:00
Silvan Mosberger
8a6941dbef lib.sub: inherit from lib.trivial 2024-06-20 22:47:01 +02:00
Silvan Mosberger
a32d38d380 lib.add: inherit from lib.trivial 2024-06-20 22:47:01 +02:00
Silvan Mosberger
74c87fd888 lib.lessThan: inherit from lib.trivial 2024-06-20 22:47:00 +02:00
Silvan Mosberger
64e8494f8a lib.seq: inherit from lib.trivial 2024-06-20 22:47:00 +02:00
Silvan Mosberger
597f62d782 lib.listToAttrs: inherit from lib.attrsets 2024-06-20 22:46:59 +02:00
Silvan Mosberger
00972297be lib.substring: inherit from lib.strings 2024-06-20 22:45:50 +02:00
Silvan Mosberger
f6cbaeca60 lib.head: inherit from lib.lists 2024-06-20 22:45:50 +02:00
Silvan Mosberger
0a162f4dcd lib.tail: inherit from lib.lists 2024-06-20 22:45:50 +02:00
Silvan Mosberger
6e98b0c0c6 lib.stringLength: inherit from lib.strings 2024-06-20 22:45:50 +02:00
Silvan Mosberger
357e954198 lib.length: inherit from lib.lists 2024-06-20 22:45:50 +02:00
Silvan Mosberger
d81f4e5eba lib.genList: inherit from lib.lists 2024-06-20 22:45:50 +02:00
Silvan Mosberger
30def45e47 lib.filter: inherit from lib.lists 2024-06-20 22:45:48 +02:00
Silvan Mosberger
c60c3baf23 lib.attrNames: inherit from lib.attrsets 2024-06-20 21:06:21 +02:00
Silvan Mosberger
69f84db442 lib: inherit concatLists via lib.lists 2024-06-20 21:06:21 +02:00
Silvan Mosberger
89f6418908 lib.split: Export from lib.strings.split 2024-06-20 17:59:37 +02:00
Silvan Mosberger
6c6244c37f lib.match: Export from lib.strings.match 2024-06-20 17:59:37 +02:00
Silvan Mosberger
18382c2ec8 lib.removeAttrs: Export from lib.attrsets.removeAttrs 2024-06-20 17:59:36 +02:00
Silvan Mosberger
56535c832f lib.intersectAttrs: Export from builtins 2024-06-20 17:59:36 +02:00
Silvan Mosberger
4413a877bb lib.map: Export from lib.lists.map 2024-06-20 17:59:21 +02:00
Silvan Mosberger
24af4c04ee
Merge pull request #214021 from tweag/ifilter0
lib.lists.ifilter0: init
2024-04-22 22:18:34 +02:00
Silvan Mosberger
6861ef7707 lib.lists.ifilter0: init 2024-04-22 18:33:14 +02:00
Robert Hensing
33e02424d2 lib: Document status of deprecated.nix and move it
This is all I could find after co-maintaining lib for a long time.
I've had the fortune of basically not really noticing this file,
because it has had very few interactions until the confusion in
https://github.com/NixOS/nixpkgs/pull/304277

It seems to be a state of limbo, which would be nice to resolve
(with great care), but this is not urgent, and first we should
document its status.
2024-04-21 16:04:35 +02:00
Rick van Schijndel
e00a40a257
Merge pull request #298680 from gvolpe/lib/transposeMap
lib/attrsets: add mapCartesianProduct function
2024-04-19 08:26:09 +02:00
éclairevoyant
bb4e822d1f
lib: add mdDoc back in to provide proper warning 2024-04-15 14:16:31 -04:00