Commit graph

3751 commits

Author SHA1 Message Date
Silvan Mosberger ac2c8d321c lib.fileset: Make expectEqual check more 2023-10-04 16:29:03 +02:00
Silvan Mosberger efbcf5938f lib.fileset: Add internal helpers for pretty-printing 2023-10-04 16:28:55 +02:00
Ulrik Strid 8d301f41a1
Merge pull request #256411 from wegank/zelus-init
ocamlPackages.zelus{,-gtk}: init at 2.2
2023-10-04 10:30:35 +02:00
Weijia Wang 79dc25b48d licenses: add inria-zelus 2023-10-04 08:47:08 +02:00
Silvan Mosberger 81e8f48ebd
Merge pull request #258855 from tweag/fileset.doc-fix
`lib.fileset.unions`: Fix outdated docs
2023-10-04 01:24:04 +02:00
Silvan Mosberger d5743d9268 lib.fileset.unions: Fix outdated docs
Since 4f35f003e6 unions supports empty lists too
2023-10-03 21:56:53 +02:00
Silvan Mosberger 86802e19ce lib.fileset: _simplifyTree -> _normaliseTreeFilter 2023-10-03 21:27:42 +02:00
Silvan Mosberger b3c2281219 lib.fileset: Order noEval last 2023-10-03 21:27:40 +02:00
Silvan Mosberger 43e4d8a6a1 lib.fileset: Link to user documentation from contributor docs 2023-10-03 18:50:18 +02:00
Robert Hensing 812887f16f
Merge pull request #257351 from tweag/fileset.empty
`lib.fileset`: Representation for empty file sets without a base path
2023-10-03 18:26:09 +02:00
Robert Hensing c0838e12af
Merge pull request #258080 from tweag/fileset/no-ulimit
lib.fileset: Don't use non-reproducible ulimit for stack overflow testing
2023-10-03 18:00:36 +02:00
Silvan Mosberger 4f35f003e6 lib.fileset: Internal representation v3, empty value without a base
`unions []` now works!

Notably the new empty value without a base is not exposed in the interface.
I don't know of any use case for it.
2023-10-03 17:05:57 +02:00
Fabian Affolter 4984613adb
Merge pull request #251812 from LeSuisse/licenses-elv2
lib/licenses: add Elastic License 2.0, drop Elastic License
2023-10-02 22:11:16 +02:00
Ryan Lahfa 37747348cd
Merge pull request #257143 from peat-psuwit/netdata-no-v2-dashboard 2023-10-02 21:01:36 +02:00
Vladimír Čunát 58aa673711
Merge #257338: fdk-aac: fix the license 2023-10-01 18:57:58 +02:00
Artturi bf25d8782b
Merge pull request #249069 from amjoseph-nixpkgs/pr/lib/systems/ubootArch
lib.systems: add ubootArch
2023-09-30 10:45:36 +03:00
Silvan Mosberger 3cbbea53a1 lib.fileset: Don't use non-reproducible ulimit for stack overflow testing 2023-09-29 20:30:29 +02:00
linsui a50cea84be lib.gvariant: make the tests really work 2023-09-28 16:30:05 +02:00
Anderson Torres cc3383d12b lib: add cmakeOptionType, cmakeBool and cmakeFeature 2023-09-27 20:49:38 -03:00
Silvan Mosberger dd72ff27f7 lib.attrsets.foldlAttrs: Make stricter
See the parent commit for the same change to lib.lists.foldl'
2023-09-27 02:43:59 +02:00
Silvan Mosberger 3b6169f87b lib.lists.foldl': Make strict in the initial accumulator
To maintain backwards compatibility, this can't be changed in the Nix language.
We can however ensure that the version Nixpkgs has the more intuitive behavior.
2023-09-27 02:43:59 +02:00
Silvan Mosberger 857a844ea8 lib.lists.foldl': Redo documentation
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2023-09-27 02:43:36 +02:00
Silvan Mosberger 9893fee947 lib.lists.foldl': Add tests 2023-09-26 18:55:54 +02:00
Silvan Mosberger 7a0b5c36c9 lib.lists.foldl': Remove fallback
Nix 2.3, the minimum Nix version supported by Nixpkgs, has
`builtins.foldl'` already.
2023-09-26 18:55:54 +02:00
FavoritoHJS 5d5c872bdf
licenses: add Fraunhofer FDK AAC Codec Library
This license is used by the Fraunhofer FDK codec, which is currently
mislicensed to Apache 2.0.

Of course, this can't be corrected without having the proper license
available in lib.licenses can't it??

Thanks @trofi for noticing this has an SPDX ID.
2023-09-26 16:00:44 +00:00
Ratchanan Srirattanamet 20b83a46d6 netdata: disable installation of non-free v2 dashboard
The v2 dashboard (included since version 1.41.0) is licensed under
Netdata Cloud UI License v1.0, which is a non-free license.

Patch the source code so that the v2 is not included in the source
and the result derivation. Users that want the v2 dashboard can still
request it by overriding this derivation and pass `withCloudUi = true`.

Co-authored-by: Raito Bezarius <masterancpp@gmail.com>
Fixes: https://github.com/NixOS/nixpkgs/issues/256964
2023-09-24 21:51:09 +00:00
Artturi 6f300706ef
Merge pull request #247077 from jmbaur/aarch64-embedded-rustc 2023-09-23 06:30:47 +03:00
Weijia Wang 9a1a55c2c3 licenses: fix full name of inria-icesl 2023-09-21 16:30:58 +00:00
Robert Hensing 5c97f01a9d
Merge pull request #255025 from tweag/fileset.union
`lib.fileset.union`, `lib.fileset.unions`: init
2023-09-21 11:49:57 +02:00
Niols 702f067ff0 licenses: add OCaml LGPL Linking Exception 2023-09-21 10:57:54 +02:00
Artturi aeaa0a7be9
Merge pull request #247288 from amjoseph-nixpkgs/pr/lib/systems/qemu-mips64n32 2023-09-21 03:06:24 +03:00
Silvan Mosberger 94e103ee3f lib.fileset: Minor changes from feedback
Co-authored-by: Robert Hensing <robert@roberthensing.nl>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-09-21 00:21:02 +02:00
Silvan Mosberger fe6c1539cc lib.fileset: Internal representation v2, ~12x faster unions!
$ ./benchmark.sh HEAD
    [...]
    Mean CPU time 0.04006 (σ = 0.0040146) for 10 runs is 8.193619775953792% (σ = 0.9584251052704821%) of the old value 0.488917 (σ = 0.0294955)
    [...]
2023-09-21 00:21:02 +02:00
Silvan Mosberger 45bf2c7617 lib.fileset: Ignore irrelevant shellcheck warnings 2023-09-21 00:21:01 +02:00
Silvan Mosberger e05cf47184 lib.fileset: Use a nix-shell shebang for benchmark.sh 2023-09-21 00:21:01 +02:00
Silvan Mosberger c9c9c093cf lib.fileset: Have benchmark.sh measure the time 2023-09-21 00:21:01 +02:00
Silvan Mosberger c8bac6ea0f lib.fileset: Add benchmark for unions 2023-09-21 00:21:01 +02:00
Silvan Mosberger 631ad21692 lib.fileset: More reusable benchmark code 2023-09-21 00:21:01 +02:00
Silvan Mosberger 7ab764e575 lib.fileset.unions: Don't stack overflow for many files 2023-09-21 00:21:01 +02:00
Silvan Mosberger e04e40d05e lib.fileset: Optimise tests
Previously a lot of processes were used, slowing it down considerably
the more files were tested
2023-09-21 00:21:01 +02:00
Silvan Mosberger c5ae093f13 lib.fileset: Various updates relating to union/unions
Also some minor formatting improvements
2023-09-21 00:21:01 +02:00
Silvan Mosberger f78d65067f lib.fileset: Create tests for union and unions 2023-09-21 00:21:01 +02:00
Silvan Mosberger bd52895222 lib.fileset.unions: init 2023-09-21 00:20:58 +02:00
Silvan Mosberger d866a0bda1 lib.fileset.union: init 2023-09-21 00:19:48 +02:00
Robert Hensing 00e5487906
Merge pull request #249243 from lf-/jade/declarationsWithLocations
nixos/modules: Add declarationPositions
2023-09-17 19:43:07 +02:00
Silvan Mosberger 7c6b0b107a lib.fileset: Minor internal type doc fix 2023-09-13 23:32:29 +02:00
Silvan Mosberger 7d4eb3f1b7 lib.fileset.toSource: Evaluate fileset even for empty directories 2023-09-13 23:32:14 +02:00
nicoo fe138d36c9 doc: Replace sha256 with hash where appropriate 2023-09-13 17:24:49 +00:00
Silvan Mosberger 19b39dcc93 lib.fileset: Internal representation v1 2023-09-13 18:53:53 +02:00
Silvan Mosberger 48abfde844 lib/fileset: Test function improvement
We can now test returned paths being equal, no need to work around it
anymore by making sure paths aren't returned (which would import them
with the previous --json)
2023-09-13 18:43:36 +02:00
Robert Helgesson 54bc9b45a3
Merge pull request #250220
lib.generators.toGitINI: escape string values in configuration
2023-09-11 23:44:42 +02:00
Moritz Angermann 1e0561d78a nixpkgs/systems: Add ucrt64 as MinGW libc
The Minimalist Gnu for Windows distribution comes with support for
the traditional msvcrt libc, as well as ucrt64 libc. The latter
being the newer universal compiler runtime. We follow the msys2
environment naming convention[1]:

| name       | toolchain | arch    | libc   | libc++    |
|------------|-----------|---------|--------|-----------|
| mingw32    | gcc       | i686    | msvcrt | libstdc++ |
| mingw64    | gcc       | x86_64  | msvcrt | libstdc++ |
| ucrt64     | gcc       | x86_64  | ucrt   | libstdc++ |
| clang32    | llvm      | i686    | ucrt   | libc++    |
| clang64    | llvm      | x86_64  | ucrt   | libc++    |
| clangarm64 | llvm      | aarch64 | ucrt   | libc++    |

For now nixpkgs only supports the first three with this commit.

--
[1]: https://www.msys2.org/docs/environments/
2023-09-08 10:56:08 +00:00
Jade Lovelace a1d3882307 nixos/modules: Add declarationPositions
What it does: line and column level *declaration* position information:

$ nix repl .
nix-repl> :p nixosConfigurations.micro.options.environment.systemPackages.declarationPositions
[ { column = 7; file = "/nix/store/24aj3k7fgqv3ly7qkbf98qvphasrw9nb-source/nixos/modules/config/system-path.nix"; line = 63; } ]

Use cases:
- ctags over NixOS options, as will be presented at NixCon 2023 ;)
- improving the documentation pages to go to the exact line of the
  declarations.

Related work:
- https://github.com/NixOS/nixpkgs/pull/65024

  This one does it for all *definitions* rather than declarations, and
  it was not followed through with due to performance worries.
- https://github.com/NixOS/nixpkgs/pull/208173

  The basis for this change. This change is just a rebase of that one.
  I split it out to add the capability before adding users of it, in
  order to simplify review. However, the ctags script in there is a
  sample user of this feature.

Benchmarks: conducted by evaluating my own reasonably complex NixOS
configuration with the command:
`hyperfine -S none -w 1 -- "nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath"`

```
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
  Time (mean ± σ):      8.971 s ±  0.254 s    [User: 5.872 s, System: 1.388 s]
  Range (min … max):    8.574 s …  9.327 s    10 runs

Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
  Time (mean ± σ):      8.766 s ±  0.160 s    [User: 5.873 s, System: 1.346 s]
  Range (min … max):    8.496 s …  9.033 s    10 runs
```

Summary of results: it seems to be in the noise, this does not cause any
visible regression in times.
2023-09-08 11:48:40 +02:00
Artturin 5472b08075 lib/systems: disable pipewireSupport in qemu-user
Option added in 5b0ed68c10

it causes infinite recursion in cross builds

There's a another inf rec that needs 6946977de0 which is in staging
2023-09-08 00:23:19 +03:00
Silvan Mosberger d66929b7b1
Merge pull request #245623 from tweag/fileset.toSource
File set combinators base: `lib.fileset.toSource`
2023-09-02 04:07:02 +02:00
Silvan Mosberger 465e05c0c5 lib.fileset.toSource: init 2023-09-01 15:46:04 +02:00
Jan Tojnar 434d160d7c
Merge pull request #234615 from linsui/dconf
nixos/dconf: support generating from attrs
2023-08-28 18:31:52 +02:00
Thomas Gerbet e39d579918 lib/licenses: add Elastic License 2.0, drop Elastic License
This license was introduced in the Elastic search repository by this
commit: a92a647b9f

It appears that all the the packages in nixpkgs using the Elastic License are using the v2.0.
2023-08-27 18:29:26 +02:00
Artturin 724cc0cba3 makeScopeWithSplicing: fix makeScopeWithSplicing' call
makeScopeWithSplicing: fix comment
2023-08-21 19:57:34 +03:00
VwCSXg 147560180c lib.generators.toGitINI: added test
Added basic generators.toGitINI test.
Mostly taken from 958c06303f/tests/modules/programs/git/git.nix.
The ${"\t} escape is used so that the lines aren't recognized as "Wrong
indent style".
2023-08-21 13:12:40 +02:00
Artturi bde196dde9
Merge pull request #245957 from amjoseph-nixpkgs/pr/lib/customization/makeScopeWithSplicing2 2023-08-20 18:57:05 +03:00
Robert Helgesson a88b90c9db lib.generators.toGitINI: escape string values in configuration
This should handle the special characters that typically occur.
Upstreaming of 642d9ffe24
2023-08-19 19:22:41 +02:00
Robert Hensing 5ad01f1b6f lib/modules: Report a better error when option tree has bare type
Improves on 0d472a6201
- https://github.com/NixOS/nixpkgs/pull/242339

We actually do have the file name.

Thanks Shawn8901 for the [feedback]!

feedback: https://github.com/NixOS/nixpkgs/pull/242339#issuecomment-1683107055
2023-08-18 11:36:51 +02:00
John Ericson c6590b61e1
Merge pull request #238509 from amjoseph-nixpkgs/pr/knuth/respect
lib/systems/parse.nix: show respect where deserved
2023-08-16 11:14:12 -04:00
Silvan Mosberger 6adb20e965
Merge pull request #248895 from Scrumplex/getExe2 2023-08-16 02:19:22 +02:00
linsui fb52d5df86 nixos/dconf: add settings support 2023-08-15 19:20:39 +08:00
linsui da614d98e9 lib/gvariant: init 2023-08-15 19:20:39 +08:00
Sefa Eyeoglu a9a29b7059
lib/meta.nix: recommend use of getExe' in getExe warning
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2023-08-15 08:57:31 +02:00
Silvan Mosberger 150217c1ac lib.removePrefix: Optimise 2023-08-14 23:32:42 +02:00
Silvan Mosberger 8fab18d4c1 lib.removePrefix: Add tests 2023-08-14 23:29:00 +02:00
Silvan Mosberger 87c5a6a84f
Merge pull request #243511 from tweag/lib.lists.hasPrefix
`lib.lists.{hasPrefix,removePrefix}`: init
2023-08-14 21:15:54 +02:00
Silvan Mosberger f10a24eddd
Merge pull request #242339 from hercules-ci/modules-catch-bare-type
lib/modules: Report a good error when option tree has bare type
2023-08-14 20:30:41 +02:00
Artturin 3c1f82f99e lib.customisation.makeScope: Make overrideScope consistent with makeScopeWithSplicing
Right now converting `makeScope` to `makeScopeWithSplicing` is not
transparent to users and requires adding a warning for `overrideScope'`
in the set itself.

Warning and `overrideScope'` were added in 2018 b9dce11712 and there should be no users left after 5 years.
2023-08-14 18:46:47 +03:00
Robert Hensing 0d472a6201 lib/modules: Report a good error when option tree has bare type
Note that this removes the possibility of declaring an option
named `_type`.
2023-08-14 10:44:56 +02:00
Adam Joseph a0c77aecaa lib.systems: add ubootArch
u-boot has its own rosetta stone, almost but not exactly the same as
the Linux kernel's.  This commit adds it and the two cases where it
diverges.
2023-08-14 01:34:07 -07:00
Adam Joseph a1fdbae706 lib.customisation: add uncurried form of makeScopeWithSplicing
Deeply-curried functions are pretty error-prone in untyped languages
like Nix.  This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.

Let's add a version that uses attrset-passing form, to provide some
minimal level of sanity-checking.

This also provides defaults for keep and extra (these are often
unneeded by the user).
2023-08-14 02:50:32 +03:00
Sefa Eyeoglu 3036465760
lib/meta.nix: introduce getExe'
getExe' can be used to get a binary other than the mainProgram from a
derivation.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2023-08-13 15:45:37 +02:00
Silvan Mosberger c096e03491
Merge pull request #247825 from tweag/lib.path-md
Minor `lib.path` documentation consistency improvements
2023-08-12 08:10:15 +02:00
Robert Hensing b8435108e1 lib/path/tests: Fix test setup on darwin
These statements are taken from the `lib/test/release.nix` tests,
which previously also worked on darwin.

Unblocks https://github.com/NixOS/nix/pull/8569 when backported
2023-08-11 17:08:16 +02:00
Silvan Mosberger 6cd54de985
Merge pull request #248278 from infinisil/revert-strings-error
Change `types.string` error to a warning instead
2023-08-10 19:35:53 +02:00
Silvan Mosberger 59b08b7ee8
Merge pull request #235625 from ShamrockLee/lib-doc-tidy 2023-08-10 12:00:36 +02:00
Silvan Mosberger 5075a51403 lib.types.string: Use lib.warn instead of deprecationMessage
This will cause a poorer error message without option location
information, but it will catch all uses of its use.
2023-08-10 06:31:36 +02:00
Silvan Mosberger 040b0ad3ed Revert "lib.types.string: Deprecation error instead of warning"
This reverts commit c59c6b1c57.

This was a bit too ambitious, because no warnings were previously
triggered when `string` was nested e.g. `attrsOf string`, `nullOr
string`, etc.

Support for nested type deprecation warnings was introduced in
4b54aedee5, but had to be reverted in
a36e6760e9 because it caused infinite
recursion for some users, and I couldn't remember that it was reverted.
2023-08-10 06:25:29 +02:00
Silvan Mosberger c59c6b1c57 lib.types.string: Deprecation error instead of warning
The type has given a warning on use since [4 years ago](03392cd336b128a1639c648baf0f6c1a1271e0d2), I think it's safe to move the deprecation to the next stage: An error instead of a warning.
2023-08-08 04:13:22 +02:00
Silvan Mosberger e3ff8dbeda lib.path: Add argument docs when missing 2023-08-08 00:10:32 +02:00
Silvan Mosberger dee307ff30 lib.path: Indent comments the same 2023-08-08 00:09:08 +02:00
Silvan Mosberger b5c492b4ba lib.path: Make documentation more uniform
- Always have a trailing dot after sentences
- Link more things
- Fix some formatting
- Use `append` instead of `+ ("/"`
2023-08-08 00:06:27 +02:00
Adam Joseph 8a543acc2b lib.systems: add qemu's funky custom name for mips n32
Qemu's name for mips64[el] using the n32 ABI is "mipsn32[el]".
That's the first time I've seen that name for it.  Oh well.
2023-08-05 00:24:17 -07:00
Artturin 61c0ecea5b treewide: update mainProgram docs 2023-08-04 20:31:16 +03:00
Robert Hensing 8fa169707f
Merge pull request #242695 from tweag/lib.path.subpath.components
`lib.path.subpath.components`: init
2023-08-04 17:00:46 +02:00
Jared Baur aca7042069
lib/systems: Add rustc config for aarch64-embedded
The target aarch64-none-elf is not a valid rustc target, use
aarch64-unknown-none instead.
2023-08-03 23:35:38 -07:00
Robert Hensing 53b289836b
Merge pull request #243139 from hercules-ci/modules-test-default-argument
lib/tests/modules: Test that _module.args works when a default argume…
2023-08-02 20:12:37 +02:00
Robert Hensing e6e16bc118 lib.getExe: Do not make assumptions about the main program
Before this commit, getExe assumes that if `meta.mainProgram` is unset,
it has a main program that's named after the package name.

While this is probable, it leads to a bad error when the assumption does
not hold. If the user called `getExe` themselves, they might narrow down
the location of the assumption quite easily, but if that's not the case,
they'll have to go down the rabbit hole to figure out what went wrong.

For example, a NixOS module may use `lib.getExe` on a package-typed option
which is then used in the system configuration. This then typically leads
to a failure *after* deployment, which is bad, and it's quite likely that
the user will debug the package output contents before digging through the
NixOS module, which is bad.
Furthermore the `getExe` call is rather inconspicuous as it does not
contain something like "/bin/foo", which is bad.
Also modules can be hard to read for a newbie, which is bad.

All of this can be avoided by requiring `meta.mainProgram`.
Many packages already have the attribute, and I would expect 80% of
`getExe` usages to be covered by 20% of packages, because plenty of
packages aren't used with `getExe` anyway.

Finally we could make an effort to set `mainProgram` semi-automatically
using `nix-index`.
2023-07-31 18:56:19 +02:00
Silvan Mosberger a0b8caf3bc
Revert "lib.customisation: uncurry makeScopeWithSplicing" 2023-07-28 23:04:09 +02:00
Artturin 3716ef19d8 lib.makeScopeWithSplicing: provide default for keep,extra
These are often unneeded by the user.
2023-07-28 17:41:01 +03:00
Adam Joseph cb13669b00 lib.customisation: uncurry makeScopeWithSplicing
Deeply-curried functions are pretty error-prone in untyped languages
like Nix.  This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.

Let's switch to attrset-passing form, to provide some minimal level
of sanity-checking.
2023-07-27 21:31:59 -07:00
Robert Hensing 399ac29381
Merge pull request #244358 from tweag/lib.path.parts
`lib.path.splitRoot`: init
2023-07-27 11:05:48 +02:00
Robert Hensing 19f1d7da06
Merge pull request #245271 from sternenseemann/module-system-merge-no-type
lib/modules: handle typeless options in mergeModules
2023-07-27 10:55:08 +02:00
sternenseemann 9c35f44999 lib/modules: handle typeless options in mergeModules
mkOption does not require a `type` argument and does not set the
resulting attribute if it is not given. Consequently, we need to be
prepared to merge options that have no type information.
2023-07-26 23:58:04 +02:00
Silvan Mosberger 407db583c5 lib/path/README.md: Justify returning subpaths
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-07-26 23:29:54 +02:00
Silvan Mosberger 4e14f5fee6 lib.path.subpath.components: init
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-26 23:29:44 +02:00
Silvan Mosberger d7bf0d777a lib.path.subpath.isValid: Add definition of a subpath
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-26 23:20:19 +02:00
Silvan Mosberger b42e178ed4 lib.path.splitRoot: init
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-26 23:20:12 +02:00
Silvan Mosberger bd74cdfb2e
Merge pull request #243520 from tweag/lib.lists.commonPrefix
`lib.lists.{findFirstIndex,commonPrefix}`: init
2023-07-26 23:14:58 +02:00
Naïm Favier b97ac82725
Merge pull request #244819 from ncfavier/toKeyValue-indent
lib/generators/toKeyValue: add `indent` parameter
2023-07-25 18:57:04 +02:00
Adam Joseph 057d63a797
Merge pull request #244330 from thillux/bluefield2-remove-cpu
lib.systems.bluefield2: remove cpu profile
2023-07-24 05:50:46 +00:00
Sandro 51727ac1df
Merge pull request #242035 from Icy-Thought/zsh-abbr
zsh-abbr: init at 5.1.0
2023-07-23 23:28:33 +02:00
Naïm Favier 383fa81e6f
lib/generators/toKeyValue: add indent parameter
toKeyValue is generic enough that it is sometimes used as part of other
format generators, where it might be useful to specify the indentation
level.
2023-07-22 13:49:30 +02:00
Silvan Mosberger 7f61b01600 lib.lists.commonPrefix: init 2023-07-20 22:42:01 +02:00
Adam Joseph 7363eedd89
Merge pull request #244118 from amjoseph-nixpkgs/pr/fix/244045
lib.systems.extensions.sharedLibrary: do not `throw`
2023-07-20 07:43:12 +00:00
Silvan Mosberger 53dcfd24ad lib.lists.findFirstIndex: init
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-19 17:35:28 +02:00
Robert Hensing 814f067760
Merge pull request #238013 from tweag/lib.path.removePrefix
`lib.path.removePrefix`: init
2023-07-19 17:28:05 +02:00
Robert Hensing 0665253b86
Merge pull request #244044 from tweag/lib-readme
Create a Readme in `lib`
2023-07-19 16:34:36 +02:00
Markus Theil e43792e88d lib.systems.bluefield2: remove cpu profile
Some software, e.g. systemd, failed to build with set cpu
profile.

Signed-off-by: Markus Theil <theil.markus@gmail.com>
2023-07-19 13:38:43 +02:00
Silvan Mosberger fa503f4b92 lib.attrsets.mergeAttrsList: init
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-18 20:27:15 +02:00
Silvan Mosberger 581d7c88be lib/tests: Unify documentation of individual testable files 2023-07-18 17:22:45 +02:00
Silvan Mosberger 03431f1244 lib: Add README
Co-authored-by: Alexander Groleau <alex@proof.construction>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-18 17:22:42 +02:00
Silvan Mosberger 9fdc0bb2bf lib.lists.removePrefix: init 2023-07-14 19:36:46 +02:00
Silvan Mosberger bc8fbc2572 lib.lists.hasPrefix: init 2023-07-14 19:36:45 +02:00
Markus Theil f6f0ccd6c9 lib.systems.bluefield2: init
Add support for Nvidia's Bluefield 2 plattform as a compilation
target. There exists a version with and without crypto support,
while the crypto supported version is the most common one.

Support for the non-crypto version can be easily added in the future,
if needed.

For a datasheet of the hardware, see:

https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/documents/datasheet-nvidia-bluefield-2-dpu.pdf

Signed-off-by: Markus Theil <theil.markus@gmail.com>
2023-07-14 11:19:11 +02:00
Adam Joseph 218669e143
Merge pull request #238154 from amjoseph-nixpkgs/pr/gcc/crossStageStatic
gccCrossStageStatic: enable dynamic libraries, rename it
2023-07-12 23:30:43 +00:00
Robert Hensing 72f2c8d6c6 lib/tests/modules: Test that _module.args works when a default argument is set 2023-07-12 21:54:57 +02:00
Robert Hensing 8014460c4d lib.mergeModules: Add context to error message 2023-07-11 13:03:52 +02:00
Robert Hensing 8f700580b9 lib/modules.nix: Format 2023-07-11 13:03:52 +02:00
Robert Hensing 4dd51a9ace lib/modules.nix: Inline single-use subtree bindings 2023-07-11 12:33:41 +02:00
Robert Hensing 6acc3114c3 lib/modules.nix: Make entire definition list strict in config check
This is a non-trivial refactor that slightly changes the semantics
of the internal definition lists.
Whereas previously only individual list items would trigger the exception,
now the error is promoted to the whole list.
This is mostly ok, because we compute the value, it is wrong to ignore a definition.
However, we don't always compute the value. For instance `readOnly`
only needs to count definitions. That won't be possible anymore when
the error is raised for one of the items. As a consequence, an error
will be raised for the errant definition instead of the number of
definitions.
2023-07-11 12:22:58 +02:00
Robert Hensing c28dd7d921 lib/modules.nix: Rename defnsByName -> pushedDownDefinitionsByName 2023-07-11 12:22:58 +02:00
Robert Hensing 448b153f81 lib/modules.nix: Rename defnsByName' -> rawDefinitionsByName 2023-07-11 12:22:58 +02:00
Robert Hensing fb988c6193 lib/modules.nix: Apply argument module of old f 2023-07-11 12:22:57 +02:00
Robert Hensing eb410eab82 lib/modules.nix: Apply argument modules of old old old byName 2023-07-11 12:22:57 +02:00
Robert Hensing 65de18210d lib/modules.nix: Apply argument f of old old byName 2023-07-11 12:22:57 +02:00
Robert Hensing c70a5e9223 lib/modules.nix: Apply argument attr of old byName 2023-07-11 12:22:08 +02:00
Robert Hensing d1e18a369a lib/modules.nix: Inline byName
byName is not an abstraction. This is the first commit in a series
that refactors it away.
2023-07-11 11:37:56 +02:00
Silvan Mosberger 6626d8cc4d lib.path.removePrefix: init 2023-07-10 21:25:43 +02:00
Robert Hensing 1f8b5c039e lib.fix: Improve doc
The original doc did not help with understanding at all, and the
wikipedia link was actively harmful.
2023-07-08 20:09:24 +02:00
Robert Hensing aa1beb0ab5 doc: Render lib.fixedPoints 2023-07-08 18:46:08 +02:00
Icy-Thought 68a3f565fb
licenses: add Hippocratic License v3.0 2023-07-07 12:37:12 +02:00
Ryan Burns 2964b720de
Merge pull request #240825 from r-burns/mips-embedded
lib.platforms.mips{,64}-embedded: init
2023-07-05 21:26:47 -07:00
Naïm Favier aaddc08519
Merge pull request #241645 from ncfavier/lib-no-hashes
lib/tests: invalidate hashes
2023-07-05 12:07:36 +02:00
Naïm Favier f66b401fa3
lib/tests: invalidate hashes
Having the current bash hash present in the nixpkgs tree makes Nix
detect bash as a runtime dependency of nixpkgs, which in turns messes up
`fetchFromGitHub` due to https://github.com/NixOS/nix/issues/6660
2023-07-05 11:31:58 +02:00
Artturi 359e1136a6
Merge pull request #239120 from LibreCybernetics/arch-stuff 2023-07-05 00:20:25 +03:00
Adam Joseph d278fd78af lib.systems.extensions.sharedLibrary: do not throw
Because downstream code expects to use `==` on platform attrsets, we
are unfortunately not able to throw a useful error message when the
`sharedLibrary` attribute is accessed.

When users do a comparison like:

  stdenv.hostPlatform == pkgsStatic.stdenv.hostPlatform

... in a situation where `stdenv.hostPlatform.hasSharedLibraries`,
they expect this to return `false`.  Unfortunately Nix does a deep
equality comparison here, and ends up forcing the
`pkgsStatic.stdenv.hostPlatform.extensions.sharedLibrary` attribute,
which throws the error.

Rather than returning `null`, this commit instead simply omits the
`extensions.sharedLibrary` attribute.  This provides the user with a
more-useful error message: instead of waiting until the `null` is
used (and hoping that produces an error), the user will get an error
about the `extensions.sharedLibrary` attribute being missing, at the
position where it was referenced.

Big thanks to @trofi for his PR to add
`NIX_VALIDATE_EVAL_NONDETERMINISM` to Nix, which I am now using.  It
made tracking this down really easy!

Fixes #244045
2023-07-04 13:39:19 -07:00
Artturi f73b89d2d3
Merge pull request #240555 from Artturin/iniglobsecneed 2023-07-04 22:48:06 +03:00
Martin Weinelt c31bda504c
lib/trivial: Bump oldestSupportedReleaseto to 23.05 2023-07-04 14:17:58 +02:00
Pol Dellaiera bf2dca1111
Merge pull request #237895 from emilytrau/tart
tart: init at 1.6.0
2023-07-02 11:37:49 +02:00
Adam Joseph 6980e6b35a lib.systems: introduce hasSharedLibraries
This commit adds `hasSharedLibraries` to `lib.systems`.

We need `plat.hasSharedLibraries` in order to know whether or not to
expect `gcc` (and many other tools) to emit shared libraries (like
`libgcc_s.so`).  Many of the GNU build scripts are smart enough that
if you configure them with `--enable-shared` on a platform (such as
`arm-none-eabi`) that doesn't support dynamic linking, they will
simply skip the shared libraries instead of aborting the
`configurePhase`.  Unfortunately the missing shared libraries in the
final build product cause very hard-to-troubleshoot problems later
on.

The alternative to introducing `hasSharedLibraries` would be to set
`isStatic` in these situations.  However doing so causes
`make-derivation.nix` to insert `-static` between the `pname` and
`hostPlatform` suffix, which is undesirable.

If at some point in the future we eliminate the `-static` suffix,
then `hasSharedLibraries` can be made equal to `!isStatic`.
2023-07-01 13:12:22 -07:00
figsoda 0fda9628c3
Merge pull request #239255 from figsoda/string 2023-06-30 22:14:10 -04:00
Ryan Burns c8ae88d97b lib.platforms.mips{,64}-embedded: init 2023-06-30 18:19:00 -07:00
Adam Joseph 4cb579b536 lib.systems: add gnuabin32 to isGnu
The `isGnu` predicate was missing `gnuabin32`.  This commit corrects
that by adding it.
2023-06-29 12:26:12 -07:00
Artturin ce54db6fe1 lib.generators.toINIWithGlobalSection: give sections a default
often sections aren't needed when using globalSection

currently one has to `sections = { }` when using only globalSection

```
lib.generators.toINIWithGlobalSection { } {
  globalSection = {
    background_color = "1d202199";
  };
  sections = { };
};
````
2023-06-29 18:41:34 +03:00
Naïm Favier 3ef988ce97
Merge pull request #237259 from ncfavier/extraDependencies-path
nixos/top-level: change extraDependencies from packages to paths
2023-06-27 11:59:06 +02:00
Naïm Favier 4bdff8cbbb
lib/tests: remove experimental-features
Now that the lib is tested with Nix 2.3, this isn't needed any more and
causes warnings.
2023-06-27 11:48:53 +02:00
Robert Hensing 18111335ed
lib/tests/modules.sh: Test types.pathInStore
Add missing test cases. I think the .links case should be rejected
even though it's technically a path in the store.
2023-06-27 11:48:53 +02:00
Naïm Favier 14d3e5685a
lib/types: add pathInStore 2023-06-27 11:48:08 +02:00
apfelkuchen6 ba6c229037
texlive: fix licensing information for doc-only-packages (#239528)
* licenses: add opubl

* texlive: fix license for npp-for-context and lshort-german

This unbreaks evaluation for `texlive.combine { inherit (texlive) scheme-full;
pkgFilter = (_: true) }`. The problem doesn't manifest for the default pkgFilter
as `npp-for-context` is a doc-only-package (that by the way has recently been
removed from texlive).
2023-06-26 20:31:28 +02:00
Robert Hensing e17f4dae6f lib/path/tests/prop.sh: Add --show-trace 2023-06-26 12:25:36 +02:00
Robert Hensing 050e7e29aa lib/path/tests: Add --show-trace
This should help troubleshoot errors.
Fyi --eval is just a flag, not an option with a value.
2023-06-26 12:12:34 +02:00
Hugh O'Brien 636db898eb
lib.licenses: add Sustainable Use License (#239455) 2023-06-25 07:07:49 +00:00
Fabián Heredia Montiel 79dfc50bb8 lib.systems.architectures: add microarchitecture levels
Variation on:
- https://github.com/NixOS/nixpkgs/pull/208398
- https://github.com/NixOS/nixpkgs/pull/224978

Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
Co-authored-by: Shawn8901 <shawn8901@googlemail.com>
Co-authored-by: AveryanAlex <alex@averyan.ru>
2023-06-24 00:50:40 -06:00
Robert Hensing b1ad9cd27d
Merge pull request #238136 from hercules-ci/nixos-nixpkgs-dont-check-when-_module.args.pkgs-is-set
`nixos/nixpkgs`: Don't check when `_module.args.pkgs` is set
2023-06-23 19:17:36 +02:00
Artturi e360d8541a
Merge pull request #239233 from Artturin/finishremovals1 2023-06-23 20:09:54 +03:00
Robert Hensing 895ac17634
lib/modules.nix: Clean up mergeAttrDefinitionsWithPrio impl 2023-06-23 18:10:49 +02:00
figsoda 8283d3d8d1 lib/types: remove unused rec 2023-06-23 09:41:04 +00:00
figsoda 1b8df7c8d7 lib/sources: remove unused let bindings 2023-06-23 09:41:04 +00:00
figsoda 8a1a028694 lib/modules: remove unused let bindings 2023-06-23 09:41:04 +00:00
figsoda c783b54650 lib/licenses: remove unused rec 2023-06-23 09:41:04 +00:00
figsoda dafa046a1e lib/filesystem: remove unused let bindings 2023-06-23 09:41:04 +00:00
figsoda 350e835584 lib/debug: remove unused let bindings 2023-06-23 09:41:04 +00:00
figsoda 12e01c677c lib/attrsets: remove unused let bindings 2023-06-23 09:41:04 +00:00
figsoda 57ca44c0ae lib: simplify stringToCharacters 2023-06-22 18:27:15 -04:00
Artturin ec7d5c518c splice.nix: finish nativeDrv,crossDrv removal 2023-06-22 23:11:08 +03:00
Adam Joseph 00a749a3a6 lib/system: move toLosslessStringMaybe into lib/tests
toLosslessStringMaybe is not used by anything other than lib/tests,
so it can be private to that file.

I don't think this function was terribly well thought-through.  If
people start using it, we will become permanently dependent on the
ability to test platforms for equality.  It also makes the
elaboration process more fragile, because it encourages code outside
of nixpkgs to become sensitive to the minute details of how
elaboration happens.
2023-06-22 00:18:33 -07:00
Robert Hensing 43be38bd78
Merge pull request #237610 from tweag/lib.path.hasPrefix
`lib.path.hasPrefix`: init
2023-06-21 13:36:25 +02:00
Astro 2214581218 licenses: add mulan-psl2 2023-06-20 12:42:05 +00:00
Sandro 9a670fec3b
Merge pull request #237167 from CHN-beta/master 2023-06-19 14:14:03 +02:00
pennae c8b4e5d557
Merge pull request #237557 from pennae/dedocbookify-nixos
nixos/doc: dedocbookify
2023-06-19 14:05:03 +02:00
Adam Joseph 92939f4ce2 lib/systems/parse.nix: show respect where deserved
The eminent Donald E. Knuth should be recognized as having equal
standing with such entities as IBM, Apple, and the Personal
Computer.  We should acknowledge this by including him as a "vendor".

Also, `gnu-config` recognizes `mmix-knuth-*` triples (and in fact
requires `vendor="knuth"` when `cpu="mmix"`) -- so we sort of have
to.  But we should do it anyways.
2023-06-18 21:02:46 -07:00
Weijia Wang 50f3cc9407
Merge pull request #238480 from amjoseph-nixpkgs/pr/lib-systems-redundant
lib/systems: remove redundant test from selectEmulator
2023-06-19 06:49:36 +03:00
Pol Dellaiera adae46b073
Merge pull request #238456 from apfelkuchen6/texlive-licenses
texlive: add licensing information
2023-06-19 05:08:56 +02:00
apfelkuchen06 b165189b97 licenses: add GFL 2023-06-19 01:53:59 +02:00
apfelkuchen06 a2c3bc9df6 licenses: add GFSL 2023-06-19 01:53:59 +02:00
apfelkuchen06 ed95697332 licenses: add Artistic-1.0-cl8 2023-06-19 01:53:55 +02:00
apfelkuchen06 e4fdd4e6ae licenses: add CC-BY-SA-2.0 2023-06-19 01:50:46 +02:00
apfelkuchen06 69976120f7 licenses: add CC-BY-SA-1.0 2023-06-19 01:50:38 +02:00
apfelkuchen06 617c9e26a2 licenses: add CC-BY-1.0 2023-06-19 01:50:33 +02:00
apfelkuchen06 b21e509367 licenses: add LPPL-1.3a 2023-06-19 01:50:25 +02:00
apfelkuchen06 24c524f89d licenses: add LPPL-1.0 2023-06-19 01:50:18 +02:00
Adam Joseph 6c9be0bf7a lib/systems: remove redundant test from selectEmulator
Commit eef4bbd82f changed the conditional in selectEmulator from
`isCompatible` (which examines only the CPU, rather than the entire
platform) to `canExecute`.  This made the first conjunct redundant.
Let's drop the redundant part.

https://github.com/NixOS/nixpkgs/pull/238331#discussion_r1233277119
2023-06-18 14:39:09 -07:00
apfelkuchen06 2cedfd3e51 licenses: add Knuth license 2023-06-18 17:55:21 +02:00
Robert Hensing 36ea2bbfe8 lib.modules: Add mergeAttrDefinitionsWithPrio
This will let us make assertions involving _module.args.pkgs, which
is not an option but a value attribute, and therefore doesn't have
its own highestPrio to inspect. The new function gives us that info.
2023-06-16 22:08:16 +02:00
Fabián Heredia Montiel 1b7776a3fb lib.systems: add znver4 architecture 2023-06-16 13:47:10 -06:00
pennae b9756b4de1 lib: unhide _module.args
this was a temporary fix that should hopefully no longer be necessary.
2023-06-16 19:26:23 +02:00
Emily Trau f8eadce278 licenses: add Fair Source License v0.9 2023-06-16 13:14:45 +10:00
Artturi 5ff6f51c1c
Merge pull request #237512 from hercules-ci/lib-system-equals 2023-06-15 23:30:49 +03:00
Silvan Mosberger 592213ad3f lib.path.hasPrefix: init 2023-06-15 22:29:46 +02:00
ners 7f528f2f6c licenses: add BSD-3-Clause-Clear 2023-06-15 12:35:48 +00:00
pennae d36f950d40 lib: turn *MD functions into aliases
with docbook gone and MD the default these aren't needed any more. we
can't remove them yet because there's thousands of uses, but maybe some
day we can.
2023-06-13 16:56:32 +02:00
pennae 7542a1aa8f lib/options: remove literalDocBook
no longer supported. warning when used would not be appropriate, and
docbook has been on the way out for long enough that throwing an error
should not be necessary either.
2023-06-13 16:56:30 +02:00
Robert Hensing 3150f25faa lib/tests/release.nix: Run systems tests on OfBorg 2023-06-13 10:43:12 +02:00
Robert Hensing 144018541b lib.systems.equals: Ignore all function attributes reflectively
Co-authored-by: Artturi <Artturin@artturin.com>
2023-06-13 10:22:06 +02:00