Commit graph

3448 commits

Author SHA1 Message Date
github-actions[bot] 4bda2ab514
Merge master into haskell-updates 2023-03-09 00:13:40 +00:00
sternenseemann 471b9cab41 haskell.compiler.ghcHEAD: 9.7.20221224 -> 9.7.20230217
- Christmas is over!

- Upstream has changed the name of the target triplet used for the JS
  backend from js-unknown-ghcjs to javascript-unknown-ghcjs, since Cabal
  calls the architecture "javascript":
  6636b67023

  Since the triplet is made up anyways, i.e. autoconf does not support
  it and Rust uses different triplets for its emscripten backends, we'll
  just change it as well.

- Upstream fixed the problem with ar(1) being invoked incorrectly by stage0:
  e987e345c8
2023-03-08 17:12:18 +01:00
Sandro 7f917aebcd
Merge pull request #214941 from OPNA2608/init/katawa-shoujo
katawa-shoujo: init at 1.3.1
2023-03-08 11:13:54 +01:00
pennae 61852b7faa lib: remove deprecated functions
all of these have been deprecated and raising warnings since 18.09. it's
about time we actually made good on "will be removed in the next release".
2023-03-08 03:57:38 +01:00
Atemu 19e81a9269
Merge pull request #211950 from Atemu/armv8-no-more-armv7
lib/systems/parse: stop considering armv8a able to execute armv7l
2023-03-07 19:25:32 +01:00
Felix Buehler d10e69c86b treewide: deprecate isNull
https://nixos.org/manual/nix/stable/language/builtins.html#builtins-isNull
2023-03-06 22:40:04 +01:00
Sandro 5a695ebb77
Merge pull request #210125 from OPNA2608/fix/pdisk_patchurl 2023-03-05 18:09:01 +01:00
pennae f0e8db002b lib/options: fix mkPackageOption docs
nixdoc takes everything from Type: to Example: as the type, which
misrendered a large part of the docs. it also drops sorely needed spaces
where the type had line breaks, so all has to be on one line (or use
non-standard literal spaces, which is probably worse).

also clarify what the `?` for arguments mean while we're here.
2023-03-05 01:21:46 +01:00
Naïm Favier a342ebe166
lib/strings: hide asciiTable
Since it's an attribute set, the lib function location generating code
tries to generate locations for each of the characters...
2023-03-04 13:20:49 +01:00
Valentin Gagarin 61cf0b2166
Merge pull request #219235 from patwid/strings-escape-query-for-url-encoding 2023-03-04 12:38:57 +01:00
Patrick Widmer 7089294f10 strings: add escapeQuery for url encoding 2023-03-03 20:48:55 +01:00
Robert Hensing 118bdf25a6 lib/modules: Allow an "anonymous" module with key in disabledModules
This makes the following work

    disabledModules = [ foo.nixosModules.bar ];

even if `bar` is not a path, but rather a module such as

    { key = "/path/to/foo#nixosModules.bar"; config = ...; }

By supporting this, the user will often be able to use the same syntax
for both importing and disabling a module. This is becoming more relevant
because flakes promote the use of attributes to reference modules. Not
all of these modules in flake attributes will be identifiable, but with
the help of a framework such as flake-parts, these attributes can be
guaranteed to be identifiable (by outPath + attribute path).
2023-03-01 15:03:44 +01:00
github-actions[bot] 399e2c78d4
Merge master into staging-next 2023-02-26 06:01:09 +00:00
Anselm Schüler 9769e90233 lib/options: Add more options to mkPackageOption 2023-02-26 03:00:22 +01:00
github-actions[bot] 4688cd53b6
Merge master into staging-next 2023-02-23 18:01:15 +00:00
Alyssa Ross 7ce8e7c4cf lib.licenses.asl20-llvm: replace llvm-exception
LLVM-exception only makes sense when used with the Apache 2.0 license,
so let's combine them, so it's not possible to forget one of them like
happened with llvm_15.
2023-02-23 17:42:15 +00:00
github-actions[bot] 390b789c39
Merge master into staging-next 2023-02-23 12:01:07 +00:00
hsjobeki 09ee6241b5 improves: comprehensiveness 2023-02-23 11:24:47 +01:00
hsjobeki 70c36dcfb8 add better documentation comments to lib.runTests 2023-02-23 10:21:58 +01:00
github-actions[bot] fd8dd0c966
Merge master into staging-next 2023-02-21 18:01:08 +00:00
Naïm Favier f77c364def
Merge pull request #216983 from ncfavier/showOption-comment
lib/options: update showOption comment
2023-02-21 16:31:07 +01:00
Naïm Favier 6c7d4d4f9d
lib/options: update showOption comment 2023-02-18 18:13:11 +01:00
github-actions[bot] bf5abe92d4
Merge master into staging-next 2023-02-15 18:01:14 +00:00
Sandro d05e6727a2
Merge pull request #203539 from SuperSandro2000/architectures-expand-inferiors
lib/systems/architectures: expand inferiors
2023-02-15 16:27:00 +01:00
Silvan Mosberger 1a2c2846b0 lib.path.subpath.join: init
This function can be used to safely join subpaths together
2023-02-13 14:01:17 +01:00
github-actions[bot] 0417b0e54f
Merge staging-next into staging 2023-02-10 00:03:00 +00:00
Domen Kožar 844a738b1f
Merge pull request #215455 from domenkozar/module-errors
nixos: Improve module conflict error messages
2023-02-10 02:42:28 +07:00
OPNA2608 235d9e2187 lib/licenses.nix: Add cc-by-nc-nd-30 2023-02-09 15:50:20 +01:00
Domen Kožar fe734efc9c types: suggest how to resolve the conflict 2023-02-09 08:24:12 +00:00
Domen Kožar b3cc29c288 types: explicitly state unique options are expected to be unique 2023-02-09 07:25:50 +00:00
github-actions[bot] 371c2a6303
Merge staging-next into staging 2023-02-07 18:02:15 +00:00
markuskowa 5cf138823d
Merge pull request #214930 from sheepforce/nwchem
nwchem: init at 7.0.2
2023-02-07 17:30:02 +01:00
Silvan Mosberger a770c0393c
Merge pull request #208887 from tweag/lib.path.append
lib.path.append: init
2023-02-07 17:27:37 +01:00
Phillip Seeber acb812207f lib/licenses: add ecl20 2023-02-07 10:39:46 +01:00
github-actions[bot] 99cce0e1f1
Merge staging-next into staging 2023-02-07 06:02:00 +00:00
Silvan Mosberger 0a60663e67
Merge pull request #206611 from h7x4/lib-lists-add-repeat
lib.lists: add `replicate`
2023-02-07 06:16:09 +01:00
github-actions[bot] d3648def80
Merge staging-next into staging 2023-02-07 00:02:46 +00:00
Bernardo Meurer 7b7b6c248c
Merge pull request #214856 from vamega/bencode-py 2023-02-06 15:58:58 -05:00
h7x4 7c4abbf80e
lib.lists: add replicate
`replicate` returns n copies of an element as a list.

Co-Authored-By: Silvan Mosberger <contact@infinisil.com>
2023-02-06 20:40:47 +01:00
Varun Madiath dedb550ce6 bencode-py: init at 4.0.0 2023-02-06 12:14:15 -05:00
Artturi dcc7df7fe6
Merge pull request #211685 from Artturin/splicingstuff1-split 2023-02-03 12:49:08 +02:00
Silvan Mosberger 50e4dbf35b
Merge pull request #205557 from ncfavier/concatLines
lib/strings: add `concatLines`
2023-01-31 18:05:53 +01:00
Silvan Mosberger 96d4702261
Merge pull request #213650 from urandom2/libdoc
lib: standardise attrset type syntax
2023-01-31 16:20:56 +01:00
github-actions[bot] dd1ff149da
Merge master into staging-next 2023-01-31 00:02:31 +00:00
Colin Arnott 6ff66fcbd7
lib: standardise attrset type syntax
There are a number of different syntaxes used for attrset type
signatures in our doc strings, this change standardises upon one that
uses :: for specifying attribute type, and ; terminators to be
consistent with nix syntax. There are no bugs in the functions
themselves, just that different syntaxes may confuse new users.
2023-01-30 23:53:44 +00:00
Florian Klink 31931ffc35
Merge pull request #212939 from amjoseph-nixpkgs/pr/isStatic
meta: replace predicates with pattern over elaborated platform
2023-01-30 21:13:15 +01:00
Alyssa Ross aa51704ba5
lib.systems.inspect.patterns.isEfi: drop ARMv5
I'm not aware of any ARMv5 EFI implementation.  gnu-efi doesn't
support it, so the build of systemd for armv5tel-linux is broken if
it's isEfi.
2023-01-30 19:54:06 +00:00
Robert Hensing 663c41affd
Merge pull request #212282 from hercules-ci/pkg-config-packages
defaultPkgConfigPackages: init
2023-01-30 09:48:53 +01:00
Robert Hensing 473ac9692e lib.hydraJob: Tolerate null
By allowing null, we allow code to avoid filterAttrs, improving
laziness in real world use cases.
Specifically, this strategy prevents infinite recursion errors,
performance issues and possibly other errors that are unrelated to
the user's code.
2023-01-30 00:35:34 +01:00
Alyssa Ross 4f8a5065d7
lib.systems.inspect.patterns.isEfi: remove "aarch64"
There is no "aarch64" CPU family — it counts as "arm", as can be seen
from the definition of isAarch64 above.

Checked that stdenv.hostPlatform.isEfi is still true on aarch64-linux.
2023-01-29 16:29:47 +00:00
Naïm Favier 0288ee587f
maintainers: clarify what fields are required 2023-01-27 18:05:28 +01:00
Naïm Favier 93dc2de29a
maintainers: disallow noreply.github.com emails 2023-01-27 18:05:28 +01:00
Naïm Favier 4e39849611
maintainers: make email optional
Not giving an email address is fine as long as the maintainer is
reachable through other means, such as GitHub or Matrix.
2023-01-27 18:04:20 +01:00
Adam Joseph 9c0a3417c8
Update lib/systems/inspect.nix
Co-authored-by: Naïm Favier <n@monade.li>
2023-01-27 11:56:20 +00:00
Adam Joseph 009a3f1857
Update lib/systems/inspect.nix
Co-authored-by: Naïm Favier <n@monade.li>
2023-01-27 11:16:35 +00:00
Adam Joseph 435618d9b3
Update lib/meta.nix
Co-authored-by: Naïm Favier <n@monade.li>
2023-01-27 11:16:29 +00:00
Adam Joseph 6f942d4a17
Update lib/meta.nix
Co-authored-by: Naïm Favier <n@monade.li>
2023-01-27 11:16:19 +00:00
Adam Joseph ea0bcf2505 lib/systems/inspect.nix: add platformPatterns.isStatic 2023-01-27 02:21:23 -08:00
Adam Joseph 1690aa6858 lib/meta.nix: allow patterns over entire platform, not just .parsed 2023-01-27 02:19:30 -08:00
Adam Joseph 778419b9e6 Revert "lib/meta.nix: platformMatch: allow predicate functions"
This reverts commit b7d097438b.
2023-01-27 01:49:39 -08:00
Robert Hensing 683887a79c
Merge pull request #212189 from amjoseph-nixpkgs/pr/lib/mapAttrsRecursive/comment
attrsets: clarify that mapAttrs maps over *leaf* attrs
2023-01-25 10:18:38 +01:00
Adam Joseph a4e3e16258
Update lib/attrsets.nix
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-01-25 02:52:54 +00:00
Pascal Wittmann 353e2d957c
Merge pull request #212408 from raboof/imapsync-fix-license
imapsync: fix license
2023-01-24 11:29:22 +01:00
Arnout Engelen 9b79245235
licenses: add NLPL 2023-01-24 11:24:04 +01:00
Sandro 9441b22187
Merge pull request #209769 from LoveIsGrief/simple-dlna-browser 2023-01-23 23:52:58 +01:00
Adam Joseph ee00af7a32 attrsets: clarify that mapAttrs maps over *leaf* attrs 2023-01-22 15:19:09 -08:00
Adam Joseph b7d097438b lib/meta.nix: platformMatch: allow predicate functions 2023-01-22 00:27:19 -08:00
Atemu 44e5b41871 lib/systems/parse: stop considering armv8a able to execute armv7l
In the past, most (if not all) armv8 CPUs could also execute armv7. However,
with the advent of Apple Silicon, aarch64 CPUs without any aarch32 capabilities
are now wide-spread among users.
2023-01-21 16:28:49 +01:00
Robert Hensing 5b2f597b11 lib.extendDerivation: Fix interaction between output selection and overrideAttrs 2023-01-20 02:45:34 +02:00
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
Silvan Mosberger eac2538707 lib.path.append: init
This function can be used to append strings to Nix path values in a
safe way.
2023-01-18 20:17:31 +01:00
Silvan Mosberger 5c4f616198 lib.path: Minor improvements
- Use isValid when possible instead of subpathInvalidReason: https://github.com/NixOS/nixpkgs/pull/209099#discussion_r1068714681
- Add documentation to function arguments
- Use newlines for error messages: https://github.com/NixOS/nixpkgs/pull/208887#discussion_r1069737602
- Add short comments for the unit test groups: https://github.com/NixOS/nixpkgs/pull/208887#discussion_r1072913051
- Slight formatting improvement for laws: https://github.com/NixOS/nixpkgs/pull/209099#discussion_r1068707955
2023-01-18 18:19:17 +01: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
OPNA2608 991a22a7d0 licenses: Remove unnecessary archive.org link for APSL-1.0
SPDX has a copy of it, and the url gets overridden with the spdx.org one anyway.
2023-01-17 12:10:41 +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
LoveIsGrief 346b939a09
lib/licenses add Fair license 2023-01-10 23:10:24 +01: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
Naïm Favier 0355479715
lib/versions: add pad
Pad a version string with zeros to match a given number of components.
2022-12-21 12:58:21 +01:00
Sandro 708d255245
Merge pull request #205899 from drupol/font/add-garamond-libre
garamond-libre: init at 1.4
2022-12-20 15:56:47 +01:00
Naïm Favier 8b5deda7d8
lib/strings: replace poop emoji (#206999) 2022-12-20 13:48:09 +01:00
Pol Dellaiera c690067fec
garamond-libre: init at 1.4 2022-12-20 08:35:00 +01:00
Robert Hensing 6db219730e
Merge pull request #205563 from hercules-ci/lib-modules-doc-default-and-example-error-context
lib.modules: Add error context to rendered default and example attrs
2022-12-19 23:58:50 +01:00
Sandro Jäckel c8c538f2ab
lib/types: remove loaOf 2022-12-19 08:31:43 +01:00
figsoda 695d4bc76b lib: fix typos 2022-12-17 18:59:29 -05:00
Artturin 05a2dfd674 lib.replaceChars: warn about being a deprecated alias
replaceStrings has been in nix since 2015(nix 1.10)

so it is safe to remove the fallback

d6d5885c15
2022-12-15 22:25:51 +02:00
Robert Hensing efa1140e83
Merge pull request #205457 from h7x4/lib-strings-toInt-broken-for-negative-numbers
lib.strings: fix negative number handling for `toInt` and `toIntBase10`
2022-12-11 02:26:42 +01:00
Robert Hensing 1a44080088 lib.generators.toPretty: Add attribute name to error context 2022-12-10 23:36:46 +01:00
Robert Hensing 5fb20d2f8c lib.modules: Add error context to rendered default and example attrs 2022-12-10 23:23:42 +01:00
Naïm Favier ed0b8c26f1
lib/strings: add concatLines
Like `unlines` from Haskell.

The aim is to replace the `concatStringsSep "\n"` pattern for generated
files, which doesn't add a final newline.
2022-12-10 15:56:30 +01:00
h7x4 62e863e98c
lib.strings: fix negative number handling for toInt and toIntBase10
The previous version would be unstable due to an input validation regex
not expecting a '-' in front of the number.
2022-12-10 13:16:45 +01:00
Valentin Gagarin a2b6bd7b35
Merge pull request #126213 from ryantm/lib-doc-gen
doc: auto-generate asserts and attrset library docs
2022-12-09 09:33:35 +01:00
Ryan Mulligan ac1ae0a58e doc: auto-generate asserts and attrset library docs
If all the docs are auto-generated, it should be easier to convert
them to Commonmark.

Co-Authored-By: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-Authored-By: Silvan Mosberger <contact@infinisil.com>
2022-12-08 22:58:22 +01:00
Naïm Favier 6a117e2759 nixos/doc: render option values using lib.generators.toPretty
Render un`_type`d defaults and examples as `literalExpression`s using
`lib.generators.toPretty` so that consumers don't have to reinvent Nix
pretty-printing. `renderOptionValue` is kept internal for now intentionally.

Make `toPretty` print floats as valid Nix values (without a tilde).

Get rid of the now-obsolete `substSpecial` function.

Move towards disallowing evaluation of packages in the manual by
raising a warning on `pkgs.foo.{outPath,drvPath}`; later, this should
throw an error. Instead, module authors should use `literalExpression`
and `mkPackageOption`.
2022-12-08 17:52:52 +01:00
Naïm Favier 0b661ce32a lib/generators.toPretty: escape strings properly 2022-12-08 17:52:52 +01:00
Naïm Favier 0fa7b1b004 lib/generators.toPretty: don't evaluate derivations
With the goal of making `toPretty` suitable for rendering option
values, render derivations as `<derivation foo-1.0>` instead of
`<derivation /nix/store/…-foo-1.0.drv>`.

This is to avoid causing sudden evaluation errors for out-of-tree
projects that have options with `default = pkgs.someUnfreePackage;` and
no `defaultText`.
2022-12-08 17:52:52 +01:00
Naïm Favier 22af649d14
Merge pull request #204087 from ncfavier/splitString-simplify 2022-12-08 13:30:50 +01:00
AndersonTorres 85b6175ccb lib/default.nix: include mesonOption-related functions
To bring them to the scope when calling `lib`.
2022-12-06 23:09:36 -03:00
AndersonTorres 762f0a599e lib/strings.nix: add mesonOption utility function
And some friends, to help write Meson commandline invocations.
2022-12-06 23:09:36 -03:00
Valentin Gagarin 260de5901e
Merge pull request #204103 from ncfavier/doc-mkOrder
nixos/doc: document `mkOrder` and friends
2022-12-02 17:19:40 +01:00
Naïm Favier e8927c46b8
nixos/doc: document mkOrder and friends
Add a section on ordering option definitions.

Also mention `mkDefault` in the section on `mkOverride`.

Clarify the code a bit by renaming `defaultPriority` to
`defaultOverridePriority` and introducing `defaultOrderPriority`.
2022-12-02 14:15:24 +01:00
Robert Hensing 6110a6009f lib/modules: Add context to the "option does not exist" error
Add trace items that provide context for a failed definition that
can not be caught within the Nix language.

This also adds a test for the `tryEval` behavior of `showDefs`.
2022-12-02 11:06:53 +00:00
Naïm Favier 3c2124c471
lib/strings: simplify splitString
There's no need to use `unsafeDiscardStringContext` since
ee7fe64c0a
(Nix 1.8).

Also the separator can't have a context since `builtins.split` would fail, so
we can assume it doesn't.
2022-12-02 12:04:36 +01:00
Sandro Jäckel c5923af986 lib/systems/architectures: expand inferiors 2022-11-29 01:45:05 +01:00
John Ericson 2cb8f1a0ac
Merge pull request #180964 from amjoseph-nixpkgs/pr/mkSkeletonFromList/simplify
lib/systems/parse.nix: mkSkeletonFromList: improve readability
2022-11-22 15:02:22 -05:00
Artturi 761a5ba7d8
Merge pull request #202370 from Artturin/revertpartof1
Revert "lib/trivial: fix 'error: cannot decode virtual path '/nix/sto…
2022-11-22 19:49:35 +02:00
Artturin f0e298c002 Revert "lib/trivial: fix 'error: cannot decode virtual path '/nix/store/virtual0000000000000000000000005-source''"
This reverts commit b67ee6e861.

https://github.com/NixOS/nixpkgs/issues/202244

error: a string that refers to a store path cannot be appended to a path, at /etc/nixos/nix/nixos-unstable/lib/sources.nix:193:30

appears to happen when there's a nixpkgs git submodule

> So one of the things that is different for a git submodule is that the .git folder isn't a folder, it's a textfile that contains (in my case) this:

> $ cat nix/nixos-unstable/.git
> gitdir: ../../.git/modules/nixpkgs
2022-11-22 18:33:09 +02:00
Martin Weinelt b68bd2ee52 23.05 is Stoat 2022-11-21 21:22:27 +01:00
Artturi 20fc948445
Merge pull request #170737 from amjoseph-nixpkgs/fix-mips32-detection
lib/systems/platforms.nix: fix broken mips32 detection
2022-11-21 19:40:18 +02:00
figsoda 91969d8d37
Merge pull request #201527 from figsoda/lib
lib/attrsets: add concatMapAttrs
2022-11-21 11:01:43 -05:00
Artturi 8181233059
Merge pull request #201946 from Artturin/splicingstuff2
lib.overrideDerivation: override attrs in __spliced && splice.nix: start deprecating nativeDrv and crossDrv
2022-11-20 15:07:28 +02:00
Artturin 341e6fd558 splice.nix: start deprecating nativeDrv and crossDrv 2022-11-19 00:04:54 +02:00
Artturin 7022556622 lib.overrideDerivation: override attrs in __spliced 2022-11-18 18:44:12 +02:00
Artturin 962929884a lib/sources: make commitIdFromGitRepoOrError internal and use # for comments
so that it doesn't make the manual build fail

> Apparently this is related to the combination of this new function not getting exported from the file, while still getting documented.
2022-11-18 17:17:51 +02:00
figsoda f993f8a186 lib/attrsets: add concatMapAttrs 2022-11-17 10:41:53 -05:00
figsoda 4536ebad69 lib/attrsets: simplify chooseDevOutputs 2022-11-17 09:41:47 -05:00
Artturi e3bd5d17b2
Merge pull request #199812 from Artturin/removeusagesoftostringonpath1
lib/sources: remove 2 usages of toString on a path which will be read using fileContents
2022-11-17 15:18:52 +02:00
Gabriel Arazas 62b78d1ead licenses: add bsd2WithViews 2022-11-16 12:01:53 +08:00
Adam Joseph 36a566b78f lib/systems/parse.nix: mkSkeletonFromList: improve readability
The main purpose of this PR is to make the basis for
`mkSkeletonFromList`'s decision between `cpu-kernel-libcabi` vs
`cpu-vendor-os` clear, without changing its behavior.  The existing
code obscures this decision behind a sequence of prioritized matches
(i.e. `if-then`) which jump around between different coordinates.

Two side benefits of this PR:

1. It makes the root cause of #165836 obvious: we are missing a case
   for `cpu-vendor-libcabi`.  This is why nixpkgs stumbles over
   `*-none-*`.

2. It illuminates some very weird corner cases in the existing
   logic, like `*-${vendor}-ghcjs` overriding the `vendor` field,
   and `mingw32` being transformed into `windows` in some cases.

Co-authored-by: John Ericson <git@JohnEricson.me>
2022-11-13 23:08:57 -08:00
John Ericson cd27a5b436
Merge pull request #82131 from Ericson2314/bsd-cross
FreeBSD packages: Init at 13.1
2022-11-13 21:35:17 -05:00
Silvan Mosberger b0a6ab09d5
Merge pull request #200667 from wegank/to-base-digits-type
lib.trivial.toBaseDigits: type check
2022-11-11 19:35:33 +01:00
Weijia Wang 343749453e lib.trivial.toBaseDigits: type check 2022-11-11 10:30:23 +01:00
github-actions[bot] 3ff06869dc
Merge master into haskell-updates 2022-11-10 00:16:25 +00:00
Sandro d9c3f3c0dc
Merge pull request #196007 from wegank/fdl11-remove 2022-11-09 22:31:50 +01:00
github-actions[bot] 8deed80953
Merge master into haskell-updates 2022-11-09 00:16:09 +00:00
Naïm Favier 025f32f705
lib/types: add descriptionClass for path 2022-11-08 13:31:29 +01:00
sternenseemann c7a0d75bd1 haskell.compiler.ghc92: 9.2.4 -> 9.2.5 2022-11-07 17:29:47 +01:00
Robert Hensing ec8f8f69bd lib/sources: Make pathIsGitRepo not evaluate toString path
This requires us to avoid the `tryEval` + `throw` combination,
because throw is strict in its error message, and we don't want
to drop our single clue when `commitIdFromGitRepo` is used
incorrectly.
2022-11-07 12:54:44 +01:00
Jörg Thalheim 87f4f101d7 cross/mingw: fix emulator for mingw32 2022-11-06 20:29:37 +01:00
Artturin 8c1b0192c5 lib/sources: remove 2 usages of toString on a path which will be read using fileContents
It gives a warning on the lazy-trees branch of Nix
(NixOS/nix#6530)

"warning: applying 'toString' to path '...' and then accessing it is deprecated, at '...'"

'else toString (/. + "${base}/${path}");' at line 183 may still cause a warning but i don't know how
to reach that codepath and test so im leaving it untouched

changing it to 'else /. + "${base}/${path}";'
caused this error
```
error: a string that refers to a store path cannot be appended to a path

       at /home/systems/nixpkgs/lib/sources.nix:183:20:

          182|               then path
          183|               else /. + "${base}/${path}";
             |                    ^
          184|         in if pathIsRegularFile path
```
2022-11-06 19:41:52 +02:00
Artturin b67ee6e861 lib/trivial: fix 'error: cannot decode virtual path '/nix/store/virtual0000000000000000000000005-source''
happens on lazy-trees branch of Nix (NixOS/nix#6530)
2022-11-06 07:04:53 +02:00
Anderson Torres 4b59590ac5
Revert "lib,doc: remove obvious usages of toString on paths" 2022-11-05 21:57:23 -03:00
Artturin 66cf79f282 lib,doc: remove obvious usages of toString on paths
It gives a warning on the lazy-trees branch of Nix
(NixOS/nix#6530)

one of these was also giving me an error (the one in lib/trivial probably)

```
$ nix build
warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/nixos/modules/installer/sd-card/sd
-image-aarch64.nix' and then accessing it is deprecated, at /home/artturin/nixgits/my-nixpkgs/lib/modules.
nix:349:99
warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/.git' and then accessing it is dep
recated, at /home/artturin/nixgits/my-nixpkgs/lib/sources.nix:35:32
warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/nixos/modules/system/etc/etc.nix'
and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/nixos/modules/system/etc/etc-activ
ation.nix' and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/nixos/modules/installer/sd-card/sd
-image-aarch64.nix' and then accessing it is deprecated, at «stdin»:0
error: cannot decode virtual path '/nix/store/virtual0000000000000000000000005-source'
(use '--show-trace' to show detailed location information)
```
2022-11-06 00:00:39 +02:00
markuskowa 19951ca9bd
Merge pull request #199244 from markuskowa/fix-licenses
Fix licenses in various packages
2022-11-05 12:42:48 +01:00
John Ericson 66aa02f190 lib/systems: Support FreeBSD
A tricky thing about FreeBSD is that there is no stable ABI across
versions. That means that putting in the version as part of the config
string is paramount.

We have a parsed represenation that separates name versus version to
accomplish this. We include FreeBSD versions 12 and 13 to demonstrate
how it works.
2022-11-04 16:49:28 -04:00
John Ericson f172d86a4e lib/systems: Simplify NetBSD examples
The libc will be inferred.
2022-11-04 16:49:28 -04:00
Robert Hensing 1b6e5ac952 lib/tests/modules: Test doRename 2022-11-03 13:12:58 +01:00
Shea Levy ad10d4fdef lib.modules.doRename: Don't define warning, even as undefined, if not warning.
This fixes mkAliasOptionModule in systems with no warning option.
2022-11-03 13:12:58 +01:00
Markus Kowalewski ad29005c50
arkpandora_ttf: add license 2022-11-02 22:53:58 +01:00
Weijia Wang 79f5174455 licenses: remove fdl13 2022-10-27 22:48:13 +02:00
Weijia Wang 06d0490ab3 licenses: remove fdl12 2022-10-27 22:47:29 +02:00
Weijia Wang 84d67f0574 licenses: remove fdl11 2022-10-27 22:45:22 +02:00
Silvan Mosberger 9bfc4bbd63 lib: Automatically generate lib.filesytem docs 2022-10-26 15:10:47 +02:00
Robert Hensing bc4ce318bf
Merge pull request #173949 from jacoblambda/fix-toInt-zero-padding
lib: add strings.toIntBase10 to parse zero-padded strings
2022-10-24 13:22:42 +02:00
Guillaume Girol 956e35d0b1 lib.normalizePath: the empty string is not a valid regex on darwin
presumably due to using libc++'s regex lib instead of libstdc++ on linux

Fixes https://github.com/NixOS/nixpkgs/pull/177273#issuecomment-1287562800
2022-10-24 12:25:34 +10:00
Jacob Abel ed71173841
lib/strings: Update docs and restructured code to improve readability of toInt and toIntBase10. 2022-10-23 17:50:24 -04:00
Jacob Abel 88b18dcf44
lib/strings: Improve error message for octal ambiguity in toInt 2022-10-23 17:50:24 -04:00
Jacob Abel 39a4ab78a1
lib/strings: Refactor toInt into toInt and toIntBase10 2022-10-23 17:50:24 -04:00
Jacob Abel 3d196a5f2a
lib/strings: Update toInt to handle intermixed ws and zeros. Added tests 2022-10-23 17:50:23 -04:00
Jacob Abel febff1dccd
lib/strings: allow toInt to parse zero-padded strings 2022-10-23 17:50:20 -04:00
Martin Weinelt 80fc469031 Merge remote-tracking branch 'origin/master' into staging-next 2022-10-21 22:33:42 +02:00
Sandro 5106dc0ddb
Merge pull request #196397 from fgaz/hikounomizu/init 2022-10-21 19:57:12 +02:00
github-actions[bot] c434165354
Merge master into staging-next 2022-10-21 00:05:50 +00:00
Daniel Olsen 23c1754fff lib/tests/misc: Add tests for charToInt, escapeC, and normalizePath 2022-10-20 20:12:15 +02:00
ajs124 4284ac9dfb lib.strings: Add normalizePath
dedupes extranous /'s in filepaths

Co-authored-by: Daniel Olsen <daniel.olsen99@gmail.com>
2022-10-20 20:12:15 +02:00