Commit Graph

3222 Commits

Author SHA1 Message Date
Robert Hensing
a1b2177ec4
Merge pull request #210976 from clhodapp/fix/extensible-sets
lib: make extender available on self-references
2023-01-20 01:08:16 +01:00
John Ericson
c1071e7804
Merge pull request #211622 from alyssais/valgrind-platforms
valgrind: make meta.platforms more accurate
2023-01-19 15:43:22 -05:00
Alyssa Ross
6d165a9474
lib.platforms.s390x: init 2023-01-19 17:43:50 +00:00
Alyssa Ross
541a2a5e91
lib.platforms.power: init 2023-01-19 17:43:49 +00:00
Alyssa Ross
48f3fd2d49
lib.platforms.armv7: init 2023-01-19 17:43:41 +00:00
Robert Hensing
415504e867 lib/tests/release.nix: Make nix a parameter + strictDeps
This makes bisecting nix a bit easier.

Example reproducer, invoked from nix directory:

```bash
nix-build ../nixpkgs/lib/tests/release.nix --arg nix '(builtins.getFlake "git+file://${toString ./.}").packages.x86_64-linux.default'
```
2023-01-18 01:39:38 +01:00
Chris Hodapp
06f0e49dc6 lib: make extender available on self-references 2023-01-15 11:34:05 -08:00
Nick Cao
35bede2be5
Merge pull request #184521 from dramforever/riscv-isefi
lib/systems/inspect.nix: Add riscv to isEfi
2023-01-13 14:28:11 +08:00
Adam Joseph
098c6b0bec check-meta(hasUnsupportedPlatform): use lib.meta.availableOn
`hasUnsupportedPlatform` was not updated with #37395, so it does not
understand attrsets in `meta.[bad]platforms`.  In particular,
attrsets in `meta.badPlatforms` will "fail open" and be ignored.

Let's use `lib.meta.availableOn` instead of duplicating its logic.

Thanks to @alyssais for [noticing][1].

[1][https://github.com/NixOS/nixpkgs/pull/194148#discussion_r990817610]

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2023-01-11 19:31:52 +00:00
Adam Joseph
0b90e548b5 lib/meta(availableOn): handle missing meta and empty meta.platform 2023-01-11 19:31:52 +00:00
Artturi
6ce54982ec
Merge pull request #209974 from amjoseph-nixpkgs/pr/close/209952 2023-01-10 18:33:27 +02:00
Silvan Mosberger
041b044a66 lib/path/tests: Fix property tests when "-n" is generated
When "-n" is generated by the property tests, it causes `echo` to not
output the string since it's interpreted as an option. Apparently
there's no good way to print "-n" with `echo` [1], so switching to
`printf` instead

[1]: https://unix.stackexchange.com/questions/85846/how-can-i-print-n-with-echo
2023-01-10 14:18:35 +01:00
Adam Joseph
06939ff3de add mipsisa{32,64}r6[el], closes 209952 2023-01-09 16:04:16 -08:00
Naïm Favier
fb1bc8de93
lib/modules: make mkAliasOptionModule emit DocBook
Follow-up to https://github.com/NixOS/nixpkgs/pull/208407

Removing `mdDoc` isn't enough, we need to emit actual DocBook.
2023-01-08 22:44:18 +01:00
Silvan Mosberger
d35cae9696
Merge pull request #208674 from YoshiRulz/yoshi-lib-docs
lib: Fix mismatched quotes in `lib.*` doc comments
2023-01-05 19:00:38 +01:00
pennae
e912c7bfe9 lib/modules: hide _module.args docs
unfortunately we can't unconditionally make this text markdown without
impacting downstream users of docs generation (as noted in #175586).
hide it entirely until the transition is complete.
2023-01-05 02:33:13 +01:00
pennae
9da5f12ecf modules: add mkPackageOptionMD
another transitional option factory, like mkAliasOptionModuleMD.
2023-01-05 02:33:13 +01:00
pennae
4c1cfbdb84 modules: add mkAliasOptionModuleMD
mkAliasOptionModule should not default to mdDoc descriptions because
that can break out-of-tree users of documentation infrastructure. add an
explicitly-MD variant for now, to be removed some time after the MD
transition is complete.
2023-01-05 02:33:13 +01:00
Robert Hensing
f61d4d346b
Merge pull request #205190 from NixOS/lib.path.relativeNormalise
lib.path.subpath.{isValid,normalise}: init
2023-01-03 13:46:11 +01:00
Silvan Mosberger
0667ef5dd5 lib.path.subpath.normalise: add property tests 2023-01-03 13:21:06 +01:00
Silvan Mosberger
63dd6d20db lib.path.subpath.normalise: init 2023-01-03 13:21:03 +01:00
Silvan Mosberger
98fbcf1788 lib.path.subpath.isValid: init
The first path library function
2023-01-03 13:20:36 +01:00
Silvan Mosberger
ba7ed22f84 lib.path: init README.md document
Adds initial work towards a `lib.path` library

Originally proposed in https://github.com/NixOS/nixpkgs/pull/200718, but has
since gone through some revisions

Co-Authored-By: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2023-01-03 13:19:42 +01:00
Martin Weinelt
b38111a665
Merge pull request #208698 from amjoseph-nixpkgs/pr/nss/ilp32 2023-01-03 07:00:45 +01:00
Adam Joseph
14f337afb6 lib/systems/inspect.nix: add isILP32 predicate
I've run into a few packages that need an extra flag on platforms
where `int` has more bits than `void*` does.  I know of three such
platforms:

* [aarch64ilp32], used on both Linux and also on the [Apple Watch]
* [x32], the x86 ILP32 ABI
* [mips64n32], used on [Longsoon] and Cavium Octeon routers.

This PR introduces a predicate so the package flags can be added in
a generic way.

[Apple Watch]: https://gist.github.com/woachk/943828f37c14563a607a26116435bf27#watch
[mips64n32]: https://en.wikipedia.org/wiki/MIPS_architecture#Calling_conventions
[Longsoon]: https://en.wikipedia.org/wiki/Loongson
[x32]: https://en.wikipedia.org/wiki/X32_ABI
2023-01-01 17:16:06 -08:00
Adam Joseph
de88969f12 lib/systems: fix uname.processor for powerpc{32,64}, mips64
Cross-compilation of anything downstream of gtk3 requires qemu (due to
gobject-introspection) with --target-list=*-linux-user.  Without this commit,
those qemu builds will fail on a powerpc64le host due to qemu being configured
with --cpu=powerpc64le instead of --cpu=ppc64le.  Unfortunately the build
failure message from qemu in this situation is extremely cryptic.

The root cause turns out not to be the qemu expression, but rather the fact that
on powerpc64le hostPlatform.uname.processor returns the gnu-name (powerpc64le)
for the cpu instead of the linux-name (ppc64le) for the cpu.

uname.processor on mips64el also needs adjustment -- the Linux-name is "mips64"
for both big and little endian (unlike powerpc64, where the Linux-name includes
a "le" suffix):

```
nix@oak:/tmp$ uname -m; lscpu | head -n2
mips64
Architecture:        mips64
Byte Order:          Little Endian
```

uname.processor on powerpc32 has also been adjusted.
2023-01-01 16:20:50 -08:00
YoshiRulz
7fba83890c
lib: Fix mismatched quotes in lib.* doc comments
caused problems for automated rich text generation such as
https://teu5us.github.io/nix-lib.html#customisation-functions
2023-01-02 08:25:17 +10:00
Martin Weinelt
192f844477
lib/trival: Bump oldestSupportedRelease to 2211 2023-01-01 14:57:25 +01:00
Naïm Favier
4af22aab8e
stdenv/check-meta: do deep type checks
Use a wrapper around `mergeDefinitions` to type-check values deeply, so
that e.g. `maintainers = [ 42 ];` is an error.
2023-01-01 14:10:42 +01:00
Naïm Favier
4df10debe7
lib/customisation.overrideDerivation: propagate evaluation condition
The new derivation should evaluate only if the old derivation does.

Sadly this means that the old derivation cannot depend on the new one
any more, which was used by xorgserver on Darwin. But this is not a
problem as `overrideAttrs` can (and should) usually be used instead.

This change allowed catching an invalid `meta.platforms` in the linux_rpi
kernels, which use `overrideDerivation`.
2023-01-01 14:10:42 +01:00
Robert Hensing
cb98e26aaf lib: Add isStringLike 2022-12-31 01:47:28 +01:00
Robert Hensing
d103811173 lib.isStringLike: Remove use of list
In the current implementation of Nix, this list would be allocated
over and over. Iirc pennae tried to optimize static list allocation,
but gained no significant performance improvement.
2022-12-31 01:33:47 +01:00
Robert Hensing
d0d0f7d0aa lib: Add isPath
Available since Nix 2.3, which is the Nixpkgs minimum version.
Thanks zimbatm!
2022-12-31 01:33:47 +01:00
Robert Hensing
23c25d5231 lib.strings.isConvertibleWithToString: Refactor to reuse isStringLike 2022-12-31 01:33:47 +01:00
Robert Hensing
834f0d660a lib.strings: isMoreCoercibleString -> isConvertibleWithToString
Yes, this function name is inconveniently long, but it is important
for the name to explicitly reference the function and not be mistaken
for the implicit string conversions, which only happen for a smaller
set of values.
2022-12-31 01:33:47 +01:00
Robert Hensing
872a24ebbc lib.strings: isSimpleCoercibleString -> isStringLike 2022-12-31 01:33:46 +01:00
Robert Hensing
29efb2c438 lib.types.path: Do not allow lists of strings 2022-12-31 01:03:24 +01:00
Robert Hensing
fed5dc66f8 treewide: isCoercibleToString -> isMoreCoercibleToString
No change in behavior.
2022-12-31 01:03:24 +01:00
Robert Hensing
68b6443ed6 lib.strings: Rename isCoercibleToString -> isMoreCoercibleToString 2022-12-31 01:03:24 +01:00
Robert Hensing
3a4c9bdbe6 lib.types.anything: Use isSimpleCoercibleToString
Expecting no change in behavior.
2022-12-31 01:03:24 +01:00
Robert Hensing
03063f65a5 lib.strings.toShellVar: Use isSimpleCoercibleString
Expecting no change in behavior.
2022-12-31 01:03:24 +01:00
Robert Hensing
2b4a8db032 lib.strings.isStorePath: Use isSimpleCoercibleToString
Expecting no change in behavior.
2022-12-31 01:03:24 +01:00
Robert Hensing
67cfc7a8f6 lib.strings: Add isSimpleCoercibleToString 2022-12-31 01:03:23 +01:00
Ryan Lahfa
30307eba48
Merge pull request #207453 from p-h/ulogd
ulogd: init at 2.0.8
2022-12-30 14:13:53 +01:00
Robert Hensing
ef9b04ec5f lib.types.loaOf: Update comment to say deprecate instead of remove 2022-12-29 00:49:32 +01:00
Robert Hensing
9af74cc709 Revert "lib/types: remove loaOf"
This reverts commit c8c538f2ab.

Reason: removal did not follow a deprecation process and it hurts
        nixops 1.7 users.
2022-12-29 00:48:22 +01:00
Philippe Hürlimann
c3161d81bd linuxdoc-tools: init at 0.9.82
Heavily based on original work by xvuko

Co-authored-by: xvuko <nix@vuko.pl>
2022-12-28 00:17:27 +01:00
Naïm Favier
3fc528ff7f
Merge pull request #207095 from ncfavier/linux-custom-kernel 2022-12-27 17:10:43 +01:00
Sandro
f3ae2deafb
Merge pull request #206809 from SuperSandro2000/loaOf 2022-12-25 21:39:52 +01:00
hsjobeki
5ff21bfc73 attrsets: fix and add some doc types 2022-12-24 14:08:11 +01:00