3
0
Fork 0
forked from mirrors/nixpkgs
Commit graph

3195 commits

Author SHA1 Message Date
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
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
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
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