Commit Graph

4340 Commits

Author SHA1 Message Date
Johannes Kirschbauer
9d3e649939
lib.types: init mergeTypes (#364620) 2025-02-10 22:10:30 +07:00
Johannes Kirschbauer
3c911b2aca
lib.types: init mergeTypes 2025-02-10 21:23:12 +07:00
Robert Hensing
a7c201020d
lib: Discourage use of extend (#376033) 2025-02-09 21:04:55 +01:00
Mathias Koehler
8722c7acbd lib.systems: add znver5 architecture 2025-02-09 19:07:42 +01:00
Robert Hensing
832e3542b6
lib/modules: improve mismatching class error mesage (#377345) 2025-02-08 17:54:09 +01:00
Gutyina Gergő
547acecdf3
teamspeak5_client: 5.0.0-beta77 -> 6.0.0-beta2; teamspeak refactors (#377748)
* teamspeak5_client: 5.0.0-beta77 -> 6.0.0-beta2, rename to teamspeak-6-client

* teamspeak6-client: refactor

* lib.licenses: add teamspeak license

* teamspeak{3,_server,6-client}: use teamspeak license

* teamspeak{6-client,_server}: move to pkgs/by-name

* teamspeak_server: fix meta.platforms

* teamspeak6-client: add update script
2025-02-07 20:33:09 +01:00
Robert Hensing
55a11de1b0 lib/default.nix: Update extend doc
Co-authored-by: Johannes Kirschbauer <hsjobeki+github@gmail.com>
2025-01-29 22:13:16 +01:00
Johannes Kirschbauer
b3884c8b7d
lib/modules: tests change expected error for class mismatch 2025-01-29 11:50:16 +01:00
Johannes Kirschbauer
5c35166b71
lib/modules: improve mismatching class error mesage 2025-01-29 11:49:20 +01:00
K900
7c251e2b5f
Revert "pkgs/top-level: make package sets composable" 2025-01-26 09:43:44 +03:00
Wolfgang Walther
eec21001b0
nixos/nixpkgs: pass original system args instead of elaborated
Passing the elaborated system defeats what pkgs/top-level/default.nix
tries to do: Pass only the original args and let defaults be inferred.

The underlying problem is that lib.systems.elaborate can not deal with
arbitrary overrides, but will often return an inconsistent system
description when partially overriding some values. This becomes most
prominent if trying to override an already elaborated system.
2025-01-25 18:55:03 +01:00
Robert Hensing
0f9034d8b5 lib: Discourage use of extend
It creates interoperability issues that can not be reconciled by
`lib` or maintainers of projects that use the Nixpkgs library.
Occasionally, end users may be able to solve the problems they run
into, but most are not prepared to deal with this set of problems,
nor should they be.

Typical conflict:
- User wants to propagate their own lib, because it has some function
  they like to use throughout their projects
- Project maintainer requires the project's lib to be used

No sane language uses a single namespace for combining all the things.
(Arguably not even C with its extensive use of prefixing)

Meanwhile, in Nix, all symbols are first class variables. We don't even
have the concept of a global top-level namespace to pour everything into.
With `lib` you can try to approximate that, I get the appeal of its
apparent simplicity, but since `lib` can't be global, we just don't even
get that apparent simplicity.

I apologize for not offering concrete solutions to this in the text.
The manuals are limited to reference documentation.
Alternatives - of which we have multiple - are best provided in
task-oriented documentation, e.g. nix.dev.
2025-01-23 08:27:29 +01:00
Philip Taron
b83e120344
lib.extendMkDerivation: init (#234651)
It's not the longest-open PR (May 28, 2023 -> Jan 22, 2025) but it took a while. This PR introduces a unified approach to implementing build helpers that support fixed-point arguments and bring such support to existing build helpers.
2025-01-22 05:10:25 -08:00
Tristan Ross
e427a1d3bb
llvmPackages.libc: init at 20.0.0-unstable-2024-12-08 (#363449) 2025-01-19 19:42:06 -08:00
Yueh-Shun Li
2439ead791 lib.extendMkDerivation: init
Add functions extendMkDerivation to lib.customisation.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Lin Jian <me@linj.tech>
Co-authored-by: Philip Taron <philip.taron@gmail.com>
2025-01-18 14:20:45 +08:00
Johannes Kirschbauer
77156bcc8f
doc: improve lib.options reference documentation (#316862)
* Doc: lib/options fixup wording and references

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Silvan Mosberger <github@infinisil.com>
2025-01-13 22:02:34 +01:00
Silvan Mosberger
b2ddf2d7d6
lib.collectModules: improve readability by replacing implication (#369792) 2025-01-13 21:35:30 +01:00
Silvan Mosberger
0f880eb305
lib.dropEnd (#370558) 2025-01-13 21:30:30 +01:00
Silvan Mosberger
7277b3a840
doc: improve lib.compareLists documentation (#368360) 2025-01-13 21:10:51 +01:00
Tristan Ross
41b14024d2
pkgs/top-level/stage.nix: add pkgsLLVMLibc 2025-01-10 20:54:19 -08:00
Johannes Kirschbauer
477b98b2a9
doc: improve lib.compareLists documentation 2025-01-09 11:25:44 +01:00
piegames
31777a589c
More string fixes (#367757) 2025-01-08 20:12:26 +01:00
Johannes Kirschbauer
8d18b516a2
docs: init lib.stringsWithDeps.textClosureList (#369776) 2025-01-08 13:43:09 +01:00
piegames
dd7d5339f7 treewide: Fix incorrect string indentations 2025-01-07 19:49:28 +01:00
piegames
603733851b treewide: Fix incorrect string escapes 2025-01-07 19:49:28 +01:00
Johannes Kirschbauer
5782ef8dc3
lib/types: deprecate functor.wrapped in types.listOf 2025-01-06 16:01:02 +01:00
Johannes Kirschbauer
3d92f38fbd
lib/types: refactor elemTypeFunctor for types.attrsWith 2025-01-06 15:24:48 +01:00
Robert Hensing
782a0e6581 lib.dropEnd: init
Naming borrowed from Haskell
- `base`: [`dropWhileEnd`]
- `extra`, `mono-traversable`, ...: [`dropEnd`]

[`dropEnd`]: https://hackage.haskell.org/package/mono-traversable-1.0.21.0/docs/Data-Sequences.html#v:dropEnd
[`dropWhileEnd`]: https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-List.html#v:dropWhileEnd
2025-01-03 12:04:06 +01:00
Robert Hensing
c96e907825 lib/tests/misc: Test lib.drop 2025-01-03 12:03:33 +01:00
Johannes Kirschbauer
e51cc8a2a6
lib.collectModules: improve readability by replacing implication 2024-12-31 22:47:20 +01:00
Weijia Wang
2927d4b6ba lib/trivial: update oldestSupportedRelease 2024-12-31 22:15:23 +01:00
nicoo
f91fbd1624
Merge #361424: refactor lib.packagesFromDirectoryRecursive (v2) 2024-12-28 21:11:11 +00:00
Vladimír Čunát
fc9c33366b
staging-next 2024-12-04 (#361878) 2024-12-23 14:57:53 +01:00
Silvan Mosberger
d510f60a4d
lib.generators.toPlist: escape XML syntax in strings & keys (#356502) 2024-12-23 13:47:44 +01:00
Linnnus
d1cb670ee6 lib.generators.toPlist: escape XML syntax in strings & keys
Before this patch, code like this would break generate invalid XML:

    lib.generators.toPlist {} "ab<cd"

That's obviously bad, since the call to toPlist often happens through
indirection, as is the case in e.g. the nix-darwin project. A user might
not realize that they have to escape the strings.

This patch adds the argument 'escape' to lib.generators.plist and emits
a warning if it is not set to true. In a future release, this behavior
should become the default.

I have also added a note for future maintainers, in case I forget to
actually remove the deprecated functionality in a future release.
2024-12-23 12:29:20 +01:00
github-actions[bot]
36d6a1bccd
Merge master into staging-next 2024-12-21 00:14:11 +00:00
Yueh-Shun Li
e5a9567c3a lib.customisation: remove dead code
Remove unneeded function inheritance in the let-in block.
2024-12-20 21:02:54 +08:00
Yueh-Shun Li
8788c4bff9 lib/customisation.nix: format with nixfmt-rfc-style 2024-12-20 20:57:46 +08:00
github-actions[bot]
12c211c64e
Merge master into staging-next 2024-12-18 00:15:09 +00:00
Robert Hensing
efd4a649fe lib/tests/release.nix: Expose system parameter 2024-12-16 23:49:08 +01:00
github-actions[bot]
8c5656aa89
Merge master into staging-next 2024-12-15 00:17:27 +00:00
sternenseemann
a0a35b6c24
Fix cross eval issues (#362546) 2024-12-14 22:14:52 +01:00
Artturin
764c99481a lib/tests/release.nix: Fix build if impure.nix returns a cross pkgs
In https://www.github.com/NixOS/nixpkgs/pull/341067 `ofborg-eval-lib-tests`
fails because it uses `pkgsHostTarget` of the cross pkgs

```diff
diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix
index 4d847e280f4b..7f0099b254f0 100644
--- a/pkgs/top-level/impure.nix
+++ b/pkgs/top-level/impure.nix
@@ -86,4 +86,6 @@ assert args ? system -> !(args ? localSystem);

 import ./. (builtins.removeAttrs args [ "system" ] // {
   inherit config overlays localSystem;
-})
+} // (if ((localSystem.system or localSystem) == "x86_64-linux" || (localSystem.system or localSystem) == "aarch64-linux") then {
+  crossSystem = { config = "aarch64-unknown-linux-gnu"; };
+  } else {}) )
```
2024-12-12 21:09:56 +02:00
nicoo
065b48084f lib.packagesFromDirectoryRecursive: let-bind functions called from lib
I was told it is better for eval performance:
  https://github.com/NixOS/nixpkgs/pull/361424#discussion_r1879975642
2024-12-12 18:48:45 +00:00
nicoo
1db8650fb4 lib.packagesFromDirectoryRecursive: refactor, again
This is a second take on #359941, which was reverted by
  940db5766a.

Co-authored-by: Silvan Mosberger <github@infinisil.com>
2024-12-12 18:48:09 +00:00
K900
81eb6d64ab Merge remote-tracking branch 'origin/master' into staging-next 2024-12-12 21:08:33 +03:00
Jean-François Roche
fc31945f1e
lib/systems/parse.nix: mkSkeletonFromList: improve error message (#211213)
Include the system string in the error message to give a bit more context to
the user.

Co-authored-by: Wolfgang Walther <wolfgangwalther@users.noreply.github.com>
2024-12-12 18:30:47 +01:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Silvan Mosberger
84d4f874c2 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev 78e9caf153
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:23:58 +01:00
github-actions[bot]
ceb62729d2
Merge master into staging-next 2024-12-09 18:05:05 +00:00