Commit Graph

3343 Commits

Author SHA1 Message Date
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
Daniel Olsen
4c420ee485 lib.strings: Add function to do C-style escaping 2022-10-20 20:12:15 +02:00
Daniel Olsen
a08741ffbd lib.strings: Add function to convert character to number 2022-10-20 18:58:44 +02:00
github-actions[bot]
aac580f88f
Merge master into staging-next 2022-10-20 00:05:13 +00:00
Sandro
3e6e7aa535
Merge pull request #193551 from OPNA2608/init/mac-fdisk 2022-10-19 23:34:49 +02:00
Jan Tojnar
457f28f6f8 Merge branch 'master' into staging-next
; Conflicts:
;	pkgs/development/tools/codespell/default.nix

codespell 2.2.2 switched to pyproject & setuptools_scm:
https://github.com/codespell-project/codespell/pull/2523
2022-10-19 05:24:28 +02:00
Robert Hensing
6259b29f29
Merge pull request #194035 from Ma27/show-option-quoting
lib/options/showOption: fix quoting of attr-names that are not identifiers
2022-10-18 11:31:54 +02:00
Francesco Gazzetta
f7adcd674c lib.licenses: add lal12 and lal13 2022-10-17 12:09:45 +02:00
github-actions[bot]
7df9a7a84c
Merge staging-next into staging 2022-10-13 18:07:50 +00:00
Silvan Mosberger
bb2fb15247
Merge pull request #192755 from hercules-ci/lib-types-unspecified-name 2022-10-13 16:56:23 +02:00
Vladimír Čunát
00a757ed3f
Merge branch 'master' into staging 2022-10-13 08:27:55 +02:00
OPNA2608
1e4c40896e licenses: Add apsl10 2022-10-13 01:00:46 +02:00
Sandro
2678c1b034
Merge pull request #193484 from wegank/gpl1-eol 2022-10-12 21:04:31 +02:00
Artturin
7e49471316 treewide: optional -> optionals where the argument is a list
the argument to optional should not be list
2022-10-10 15:40:21 +03:00
github-actions[bot]
3b37795067
Merge staging-next into staging 2022-10-09 18:02:10 +00:00
github-actions[bot]
44f6a02f39
Merge master into staging-next 2022-10-09 18:01:35 +00:00
Weijia Wang
7eef7379fe licenses: add libssh2 license 2022-10-09 12:01:58 +02:00
Guillaume Bouchard
98715e1b1a lib.closePropagation: Remove the quadratic behavior in lib.closePropagation
The code of `lib.closePropagation` was internally using a
recursion on the dependencies and returns all the derivation directly or
indirectly referenced by buildInputs.

`lib.closeProgation` is implemented in pure nix and uses an unique
function for list which is quadratic and does "true" equality, which
needs deep set comparison.

Instead, we use the `builtins.genericClosure` which is implemented as a
builtin and uses a more efficient sorting feature.

Note that `genericClosure` needs a `key` to discriminate the values, we
used the `outPath` which is unique and orderable.

On benchmarks, it performs up to 15x time faster on a benchmark related
to haskellPackages.ghcWithPackages.
2022-10-07 18:03:42 +02:00
Maximilian Bosch
6396482dde
lib/options/showOption: fix quoting of attr-names that are not identifiers
Personally, I think that warnings such as

    warning: The option `services.redis.enable' defined in `/home/ma27/Projects/nixpkgs/test.nix@node-vm' has been renamed to `services.redis.servers..enable'.

are fairly confusing because of the `..` and it's more correct to
actually quote that. With this change the warning now looks like this:

    warning: The option `services.redis.enable' defined in `/home/ma27/Projects/nixpkgs/test.nix@node-vm' has been renamed to `services.redis.servers."".enable'.

While implementing that I realized that you'd have
a similar problem whenever you use attribute-names that aren't
identifiers, e.g.

    services.nginx.virtualHosts."example.org".locations."/".invalid = 23;

now results in the following error:

    error: The option `interactive.nodes.vm.services.nginx.virtualHosts."example.org".locations."/".invalid' does not exist. Definition values:
           - In `/home/ma27/Projects/nixpkgs/test.nix@node-vm': 23

Of course there are some corner-cases where this won't work: when
generating the manual, you display submodules like this:

    services.nginx.virtualHosts.<name>

Since `<name>` isn't a value, but an indicator for a submodule, it must
not be quoted. This also applies to the following identifiers:

* `*` for `listOf submodule`
* `<function body>` for `functionTo`

This might not be correct if you actually have a submodule with an
attribute name called `<name>`, but I think it's an improvement over the
current situation and for this you'd probably need to make even more
complex changes to the module system.
2022-10-07 10:09:03 +02:00
Maximilian Bosch
ac48f07282
lib/types: always use <function body> instead of [function body] to indicate a function inside an option structure
The motivation is to have a single identifier for that. Useful for the
next commit where I'll try to escape option-parts correctly (options can
be any kind of strings, but unless these are Nix identifiers, they must
be quoted).

Since `<function body>` (or `<name>`/`*`) are special identifiers in
error messages and the manual, we need a unique way to mark an option
part as function call because these are not to be quoted.
2022-10-07 10:01:44 +02:00
Martin Weinelt
253ca4957d Merge remote-tracking branch 'origin/master' into staging-next 2022-10-05 00:44:16 +02:00
Sandro
0c8ac7b519
Merge pull request #188265 from steveeJ-forks/pr-holochain-launcher-bin 2022-10-03 21:12:51 +02:00
github-actions[bot]
e879e7d54e
Merge master into staging-next 2022-10-02 00:04:43 +00:00
figsoda
a1d50eecab
Merge pull request #193132 from figsoda/clean-up
treewide: clean up
2022-10-01 17:03:11 -04:00
github-actions[bot]
9c14978f84
Merge master into staging-next 2022-09-29 12:01:25 +00:00
Weijia Wang
870d6f4a98 licenses: remove gpl1 2022-09-29 10:54:21 +02:00
Ivan Nikolaenko
f251840237 lib/systems/default.nix: add efiArch suffixes
Move already implemented functionality to the upper level so
it could be used in a more generic way.

Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
2022-09-29 08:02:35 +00:00
figsoda
3f0f0c74e9 lib.generators: simplify toYAML 2022-09-28 16:34:55 -04:00
Martin Weinelt
8218d0f6b5
Merge pull request #192650 from drupol/add-sphinx-contrib-mscgen 2022-09-28 21:55:26 +02:00
github-actions[bot]
f18d801779
Merge staging-next into staging 2022-09-28 18:05:53 +00:00
Pol Dellaiera
b89b4f8354
licenses: add BOLA license 2022-09-28 15:35:51 +02:00
Robert Hensing
7f0d934f9a
Merge pull request #191540 from hercules-ci/nixosTest-modular
nixosTest: make modular
2022-09-28 10:27:45 +01:00
figsoda
f9f6872960 lib/tests/maintainers.nix: remove unused binding 2022-09-26 22:18:55 -04:00
figsoda
4ef185c1b8 lib/types.nix: remove unused bindings 2022-09-26 22:18:55 -04:00
figsoda
53052c4fb0 lib/sources.nix: remove unused binding 2022-09-26 22:18:55 -04:00
figsoda
d29b0096d3 lib/options.nix: remove unused binding 2022-09-26 22:18:55 -04:00
figsoda
05fc3747c9 lib/modules.nix: remove unused bindings 2022-09-26 22:18:55 -04:00
figsoda
07b3a5a0dd lib/generators.nix: remove unused bindings 2022-09-26 22:18:54 -04:00
github-actions[bot]
e0bea8e017
Merge staging-next into staging 2022-09-26 00:03:58 +00:00
piegames
0ada9fff8a lib/types.nix: Document that it should not be used
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2022-09-25 16:37:15 +02:00
toonn
bf9ff0c687
Merge branch 'amjoseph-nixpkgs-pr/resume182058' into staging 2022-09-25 14:45:17 +02:00
Adam Joseph
037cf2fad1 unionOfDisjoint: use builtins.intersectAttrs
This brings two benefits:

1. The complete list of collisions is printed in the whenever any colliding
   attribute is accessed.

2. The sets are intersected using a C++ primitive, which runs in O(n) time
   (intersecting pre-sorted lists) with small constants rather than interpreted
   Nix code.

Thanks to @toonn for prompting this improvement.
2022-09-25 00:09:15 -07:00
Robert Hensing
cc6dce5c0a
Merge pull request #189836 from erikarvstedt/options-definitionsWithLocations
lib/modules: add `definitionsWithLocations` to evaluated options
2022-09-24 12:43:19 +01:00
Robert Hensing
43efa4900c lib.types.unspecified: Make name match attribute name again
@Infinisil: This isn't right, the name shouldn't be changed, but instead a description should be added
https://github.com/NixOS/nixpkgs/pull/191353#discussion_r978983401
2022-09-24 12:29:09 +01:00
Robert Hensing
1ffa30b055 lib/modules: Fix meta duplication in shorthand syntax 2022-09-21 10:55:11 +01:00
Robert Hensing
fce8b018f0 lib: Add lazyDerivation 2022-09-21 10:55:07 +01:00
Adam Joseph
66810822f9 lib/systems/inspect.nix: explanatory comment 2022-09-19 19:15:35 -07:00
Robert Hensing
1cbe950384 lib.types: Add parentheses where description is ambiguous 2022-09-17 22:16:39 +01:00
Stefan Junker
60cf98b067 lib.licenses: add CAL-1.0 2022-09-15 10:09:06 +02:00
Artturi
d73864ae2f
Merge pull request #189314 from Artturin/addemulatoravailable 2022-09-13 21:13:07 +03:00
Adam Joseph
99da193877 note that unionOfDisjoint is commutative, unlike // 2022-09-12 12:59:16 -07:00
Adam Joseph
47de66b1a4 lib/attrsets.nix: add unionOfDisjoint 2022-09-12 12:53:31 -07:00
Artturin
20f90d3921 lib/systems: add emulatorAvailable
```
nix-repl> pkgsCross.arm-embedded.stdenv.hostPlatform.emulatorAvailable pkgsCross.arm-embedded.buildPackages
false

nix-repl> pkgsCross.aarch64-multiplatform.stdenv.hostPlatform.emulatorAvailable pkgsCross.aarch64-multiplatform.buildPackages
true
```

will be useful for stuff like handling https://github.com/NixOS/nixpkgs/issues/187109
2022-09-11 19:34:15 +03:00
pennae
767485a0de lib/options: deprecate docbook text and literalDocBook
deprecate literalDocBook by adding a warning (that will not fire yet) to
its uses and other docbook literal strings by adding optional warning
message to mergeJSON.
2022-09-10 18:23:13 +02:00
Silvan Mosberger
6389a26e5f
Merge pull request #181834 from ncfavier/numbers
lib/types: add `number`
2022-09-09 19:59:29 +02:00
Adam Joseph
ba3c562fdc
lib/systems: uname.processor is "uname -m", not "uname -p" (#189958)
The comment in lib/systems/default.nix for uname.processor indicates that it
should match `uname -p`.  I tried that command and found that it reports
`unknown` on all of these machines:

- `x86_64-linux`
- `aarch64-linux`
- `mips64el-linux`
- `powerpc64le-linux`

The command `uname -m` reports the expected value on all of the above.

I think the comment is wrong.  So I fixed it.
2022-09-06 10:17:09 -05:00
Erik Arvstedt
9f22df9a7f
lib/modules: add definitionsWithLocations to evaluated options
This attr provides the location of each definition.

This is particularly useful for introspecting options of type
`attrsOf`. E.g., it allows finding the location of a systemd
service definition by parsing
`options.systemd.services.definitionsWithLocations`.
2022-09-05 12:11:43 +02:00
Jonas Heinrich
4c1f1c5853
Merge pull request #161118 from arkivm/init-dwarf2json
dwarf2json: init at unstable-2021-04-15
2022-09-05 12:07:17 +02:00
pennae
3bddcf5f90
Merge branch 'master' into option-docs-md 2022-09-01 16:10:09 +02:00
pennae
e04a09082e lib/modules: convert option description to MD 2022-08-31 17:27:37 +02:00
Robert Hensing
3ebb588ab3
Merge pull request #188289 from erikarvstedt/fix-disabled-modules-abs-paths
lib.modules: support strings with absolute paths in `disabledModules`
2022-08-31 15:27:03 +02:00
Erik Arvstedt
e2cc361970
lib.modules: support strings with absolute paths in disabledModules
This is particularly useful for disabling modules defined in a flake.
Example:
disabledModules = [ "${flake}/modules/mymodule.nix" ];

Previously, absolute string paths were internally prepended with `modulesPath`,
which caused the module filtering to fail.
2022-08-31 14:23:28 +02:00
pennae
9bb82c35b7 lib/options: add mdDoc support to mkEnableOption 2022-08-30 15:05:05 +02:00
Minijackson
b2190a3cce lib/systems/doubles: add ELFvx GNU ABIs 2022-08-28 21:46:44 +02:00
Minijackson
345595a8b8 lib/systems: add convenience isAbiElfv2 function 2022-08-28 21:46:44 +02:00
Minijackson
cdb0f02a36 lib/systems/examples: use provided ABIs in PPC64 triple 2022-08-28 21:46:44 +02:00
Minijackson
3fa4274ff6 lib/systems/parse: use ELFv2 by default for PPC64 BE 2022-08-28 21:46:44 +02:00
Minijackson
da2d9a2aca lib/systems: add elfv1 / elfv2 ABIs 2022-08-28 21:46:44 +02:00
Minijackson
4db467f7e9
lib/systems: add MicroBlaze architectures 2022-08-25 16:00:42 +02:00
Vladimír Čunát
b784c5ae63
Merge #186941: staging-next 2022-08-16 2022-08-24 19:10:16 +02:00
Stig
24f160cfcd
Merge pull request #187884 from helsinki-systems/feat/perl-sri
perlPackages: Switch to SRI hashes, add `hash` support to bootstrap fetchurl, bump minimal nix version
2022-08-24 17:28:04 +02:00
Vladimír Čunát
7bfc2b2564
Merge branch 'master' into staging-next 2022-08-24 17:10:55 +02:00
Michal Sojka
c1b2e4a9b1 perlPackages.Crypt{Blowfish,DES,IDEA}: Use correct license
Recent commit 59356f11c1 ("perlPackages: Ensure all packages have a
license", 2022-08-22) added a license field to Perl packages where the
license was missing. The above mentioned packages got assigned
`unfreeRedistributable` license, which is not precise and makes all
packages depending on them unbuildable without `NIXPKGS_ALLOW_UNFREE`.

The packages actually have a license which SPDX calls
BSD-4-Clause-Shortened (https://spdx.org/licenses/BSD-4-Clause-Shortened.html).
In this commit, we add this license to the list of allowed licenses
and change the license field of the mentioned packages.

Closes #188103
2022-08-24 15:10:17 +02:00
Janne Heß
0b3e7f063c
boostrap fetchurl: Add SRI support 2022-08-24 09:55:45 +02:00
github-actions[bot]
9968240f42
Merge master into staging-next 2022-08-22 18:01:16 +00:00
Janne Heß
e6b89a5a52
perlPackages: Clarify all unfree licenses 2022-08-22 11:16:50 +02:00
github-actions[bot]
a6c886b7fd
Merge master into staging-next 2022-08-21 06:01:17 +00:00
Skyler
d61bc96d16
Fix a typo in the lib.foldr docstring
- This quote mark should be a backtick
- Using a quote mark instead of a backtick breaks formatting when rendering the docs
2022-08-20 23:58:57 +01:00
Daniel Olsen
875d77ca03 lib/systems: Add staticLibrary and library
staticLibrary includes common extensions for static libraries
library is a new common attribute that includes both shared and static extensions
2022-08-16 08:36:57 +00:00
Robert Hensing
661c29c806
Merge pull request #181222 from hercules-ci/module-specialArgs
`_module.specialArgs` + unit test for nixos/documentation module
2022-08-08 11:53:10 +02:00
sternenseemann
17746af0c5 Merge remote-tracking branch 'origin/master' into haskell-updates 2022-08-04 14:31:47 +02:00
Sandro
7c073f917a
lib/system: resolve TODO 2022-08-02 14:13:18 +02:00
dramforever
584cfd8caa lib/systems/inspect.nix: Add riscv to isEfi
EFI boot on RISC-V is supported by GRUB and systemd-boot. Add them to
isEfi to reflect this fact.
2022-08-01 16:43:55 +08:00
github-actions[bot]
093f236f30
Merge master into haskell-updates 2022-07-30 00:13:25 +00:00
Sandro
463327086d lib/systems/inspect.nix: add isAarch 2022-07-29 19:16:01 +00:00
sternenseemann
7f909b041b haskell.compiler: ghc923 -> ghc924
https://www.haskell.org/ghc/download_ghc_9_2_4.html
2022-07-28 18:09:33 +02:00
Sandro
cb9d1d71ed
Merge pull request #182217 from GuillaumeDesforges/GuillaumeDesforges@dbx-init 2022-07-27 22:29:25 +02:00
Vladimír Čunát
87980a5a14
Merge #170736: lib/systems/platforms.nix: fix mips32 ABI 2022-07-27 19:53:38 +02:00
Guillaume Desforges
b079da4c56 python3Packages.dbx: 0.5.0 2022-07-25 17:44:21 +02:00
Naïm Favier
eb72be8541
lib/types: add number
For numbers that can be ints or floats.
2022-07-24 18:03:28 +02:00
Florian Klink
7c119675a3
Merge pull request #179002 from klemensn/move-passwdEntry-type
move passwdEntry type
2022-07-22 14:16:57 +07:00
Robert Hensing
bf5b75864d lib/modules: Add _module.specialArgs 2022-07-21 15:31:34 +02:00
Rick van Schijndel
9532db9eb7
Merge pull request #160554 from Cloudef/android-prebuilt
Fix android prebuilt toolchains
2022-07-18 10:01:00 +02:00
Janne Heß
68da5b2a22
lib/trivial: Update oldestSupportedRelease 2022-07-04 20:07:44 +02:00
Alyssa Ross
e8d7d52fae lib.systems.examples: canonicalize MIPS triples
In Nixpkgs, we assume that the "config" field is a canonicalized GNU
triple.  I noticed that non-canonical values were being used here,
because the pkgsCross.mips64el-linux-gnu triples did not contain the
vendor field, but the pkgsCross.mips64el-linux-gnu.pkgsStatic did.

Here, I've run all the MIPS triples in lib.systems.examples through
config.sub to canonicalize them.  I think this will avoid nasty
surprises in future.

Tested by building Nix and the bootstrap files for
pkgsCross.mips64el-linux-gnu.
2022-07-03 23:01:21 +00:00
toastal
bf0608a642 lib.licenses: add Aladdin Free Public License 2022-07-02 15:51:25 +07:00
Jari Vetoniemi
539222e8d4 canExecute: check for android 2022-06-29 18:27:16 +09:00
Jari Vetoniemi
2a914f022c update android targets to recommended ones 2022-06-29 18:27:16 +09:00
Robert Hensing
4a8bc4fd07 lib/options: Add hint for debugging infinite recursion in docs 2022-06-27 17:41:32 +02:00
Klemens Nanni
574a90771f lib.types, nixos/users: Make passwdEntry available
More nixpkgs code such as `boot.initrd.systemd.emergencyAccess` defines
options that takes hashed passwords, so move the type definition from
modules/ into lib/.

The type definition itself stays unchanged.
2022-06-25 16:34:47 +04:00
Robert Hensing
89b4bd8b24 lib/options: Add showOptionWithDefLocs 2022-06-21 14:22:33 +02:00
Robert Hensing
e2c261f2c0
Merge pull request #176146 from pennae/module-docs-markdown
treewide: markdown option docs
2022-06-21 13:16:02 +02:00
Graham Christensen
9ed793229c teams/maintainers list: show instructions for validating the contents 2022-06-20 22:20:26 +02:00
Graham Christensen
ff38ee15c2 maintainer teams: check them in lib tests 2022-06-20 22:20:26 +02:00
Graham Christensen
3ac995a568 maintainer lib test: extract maintainer module 2022-06-20 22:20:26 +02:00
Graham Christensen
c8cebff38b maintainers: remove longkeyid
see https://dkg.fifthhorseman.net/blog/openpgp-key-ids-are-not-useful.html
2022-06-20 22:20:26 +02:00