Commit graph

4461 commits

Author SHA1 Message Date
Mikael Voss
7a07cc0da9
lib/strings: allow CA paths in isStorePath 2025-03-05 13:08:41 +01:00
Mikael Voss
6e2e984af0
lib/path: allow CA paths in hasStorePathPrefix 2025-03-05 10:30:08 +01:00
Wroclaw
0de1d18795 lib.types.functionTo: preserve functionArgs
Previously if function in defs had set pattern in argument,
this information would be lost.

This keeps functionArgs in set pattern,
by using functor and `__functionArgs`
that is later used by `lib.functionArgs`.
2025-03-02 00:04:19 +01:00
Johannes Kirschbauer
0e46672592
lib.types: Make functor.wrapped deprecation work in unprocessed types (#382848) 2025-02-21 15:57:20 +07:00
Johannes Kirschbauer
0d52202380
lib.strings: init toSentenceCase (#381802) 2025-02-20 07:58:44 +07:00
Martin Fink
2607578cc4 lib.systems.architectures: add sierra forest 2025-02-19 19:25:03 +01:00
isabel
b109863c25 lib.strings: init toSentenceCase 2025-02-19 12:10:39 +00:00
Johannes Kirschbauer
fb79705bca
lib.types: improve tests for deprecation warning on all migrated types 2025-02-19 16:54:55 +07:00
Silvan Mosberger
64a1c1da3e
lib.types: Make functor.wrapped deprecation work in unprocessed types
Otherwise nested types such as `attrsOf (attrsOf int)` won't have a
backwards compatible `type.nestedTypes.elemType.functor.wrapped`.

Follow-up work to https://github.com/NixOS/nixpkgs/pull/366015
2025-02-19 16:10:27 +07:00
Johannes Kirschbauer
7bbacbb11b
Revert "lib.types.attrsWith: remove failing test" (#382856) 2025-02-19 16:07:48 +07:00
lassulus
642babe809
Docs: migrate format of comments to doc-comments (#381381) 2025-02-19 13:51:23 +07:00
Johannes Kirschbauer
3f9d8a1fea
lib/pathWith: keep old typename, to avoid breakage in downstream projects 2025-02-19 09:03:18 +07:00
Silvan Mosberger
bdddb0c517 Revert "lib.types.attrsWith: remove failing test"
This reverts commit ce8f304bb6.

The problem was simply a typo (nestedTypes.elemType ->
type.nestedTypes.elemType) ! And CI didn't run for lib in the orginal
PR which is why it didn't get caught.
2025-02-17 16:19:40 +01:00
Johannes Kirschbauer
2f6b75b26a
lib/types: add types.pathWith (#373287) 2025-02-17 09:56:48 +07:00
Jeremy Fleischman
6d7f6a92cc
lib/types: add types.pathWith
This gives people some flexibility when they need a path type, and
prevents a "combinatorial explosion" of various path stops.

I've re-implemented our existing `path` and `pathInStore` types using
`pathWith`. Our existing `package` type is potentially a candidate for
similar treatment, but it's a little quirkier (there's some stuff with
`builtins.hasContext` and `toDerivation` that I don't completely
understand), and I didn't want to muddy this PR with that.

As a happy side effect of this work, we get a new feature: the ability
to create a type for paths *not* in the store. This is useful for when a
module needs a path to a file, and wants to protect people from
accidentally leaking that file into the nix store.
2025-02-15 16:14:06 +07:00
Daniel Flanagan
208049c89c
docs(lib): fix weird structures in attrsets docstrings 2025-02-14 23:04:58 -06:00
Johannes Kirschbauer
ef85e0daa0
Format: lib/path.nix 2025-02-12 15:01:45 +07:00
Johannes Kirschbauer
d89ad6c70e
Format: lib/versions.nix 2025-02-12 15:01:45 +07:00
Johannes Kirschbauer
e0fe216f49
Format: lib/fileset/internal.nix 2025-02-12 15:01:45 +07:00
Johannes Kirschbauer
80d5b411f6
Format: lib/sources.nix 2025-02-12 15:01:45 +07:00
Johannes Kirschbauer
88f912da48
Docs: migrate format of comments to doc-comments 2025-02-12 15:01:43 +07:00
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