Commit Graph

2569 Commits

Author SHA1 Message Date
Robert Hensing
d2a41be2f3
Merge pull request #110707 from Infinisil/functionTo
Bring back `types.functionTo`
2021-01-27 10:50:13 +01:00
Silvan Mosberger
c2f3556dc7
lib/tests: More functionTo tests 2021-01-27 00:17:56 +01:00
Silvan Mosberger
e9101d4a3b
lib/types: Improved functionTo merging
Now type checks the resulting function values and allows mkMerge and co.
Also indicates that the type check is done in the function body

Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2021-01-27 00:16:23 +01:00
Ryan Burns
8baac2af75 lib/systems: fix linuxArch for power + riscv
Looks like these got left behind in the
kernelArch -> linuxArch migration.

Fixes:
* pkgsCross.powernv.linuxHeaders
* pkgsCross.riscv64.linuxHeaders
* pkgsCross.riscv32.linuxHeaders
and dependees
2021-01-25 17:57:05 -08:00
Silvan Mosberger
9ba1f22982
Merge pull request #110672 from Profpatsch/lib-add-traceFnSeqN
lib/debug: add traceFnSeqN
2021-01-25 20:17:56 +01:00
Profpatsch
41e13149f7 lib/debug: add traceFnSeqN
Immensely helpful when you want to see the changes a function makes to
its value as it passes through.

Example:

```
$ nix-instantiate --strict --eval -E '(with import ./lib; traceFnSeqN 2 "id" (x: x) { a.b.c = 3; })'
trace: {
  fn = "id";
  from = {
    a = {
      b = {…};
    };
  };
  to = {
    a = {
      b = {…};
    };
  };
}
{ a = { b = { c = 3; }; }; }
```
2021-01-25 19:25:50 +01:00
Bas van Dijk
43243539b3
lib/tests/modules: add a test for the functionTo type
(cherry picked from commit 478af112e83df806bd8a51174834d2a130fbdeb9)
2021-01-24 16:56:45 +01:00
Bas van Dijk
b454af298d
Revert "Remove types.functionTo."
This reverts commit 4ff1ab5a56.

We need this to type options like:
services.xserver.windowManager.xmonad.extraPackages that specify functions that
take an attribute set containing packages / plugins and return a list containing
a selection of the values in this set.

The reason we need a dedicated type for this is to have the correct merge
behaviour. Without the functionTo type merging multiple function option
definitions results in an evaluation error. The functionTo type merges
definitions by returning a new function that applies the functions of all the
definitions to the given input and merges the result.

(cherry picked from commit 7ed41ff5e7e633dd64866398ee497ac02736a3a5)
2021-01-24 16:56:33 +01:00
volth
bc0d605cf1 treewide: fix double quoted strings in meta.description
Signed-off-by: Ben Siraphob <bensiraphob@gmail.com>
2021-01-24 19:56:59 +07:00
Matthew Bauer
84408a6ad0
Merge pull request #100687 from spease/add-newer-xcode-hashes
darwin: update xcode versions
2021-01-23 20:04:50 -06:00
John Ericson
9c213398b3 lib: Clean up how linux and gcc config is specified
Second attempt of 8929989614589ee3acd070a6409b2b9700c92d65; see that
commit for details.

This reverts commit 0bc275e634.
2021-01-23 10:01:28 -05:00
Jonathan Ringer
0bc275e634
Revert "lib: Clean up how linux and gcc config is specified"
This is a stdenv-rebuild, and should not be merged
into master

This reverts commit 8929989614.
2021-01-22 14:07:06 -08:00
John Ericson
d95aebbe0e
Merge pull request #107214 from Ericson2314/linux-config-cleanup
lib: Clean up how linux and gcc config is specified
2021-01-22 15:15:58 -05:00
John Ericson
8929989614 lib: Clean up how linux and gcc config is specified
The `platform` field is pointless nesting: it's just stuff that happens
to be defined together, and that should be an implementation detail.

This instead makes `linux-kernel` and `gcc` top level fields in platform
configs. They join `rustc` there [all are optional], which was put there
and not in `platform` in anticipation of a change like this.

`linux-kernel.arch` in particular also becomes `linuxArch`, to match the
other `*Arch`es.

The next step after is this to combine the *specific* machines from
`lib.systems.platforms` with `lib.systems.examples`, keeping just the
"multiplatform" ones for defaulting.
2021-01-21 22:44:09 -05:00
Silvan Mosberger
7f2fcc45f7
lib/modules: Set submodule type for renamed option sets
For renames like

  mkAliasOptionModule [ "services" "compton" ] [ "services" "picom" ]

where the target is an option set (like services.picom) instead of a single
option (like services.picom.enable), previously the renamed option type
was unset, leading to it being `types.unspecified`.

This changes it to be `types.submodule {}` instead, which makes more
sense.
2021-01-21 21:57:48 +01:00
Steven Pease
0fdab8d560 Merge branch 'master' into add-newer-xcode-hashes 2021-01-19 20:42:30 -08:00
Steven Pease
d8c1c0dc50 Update to XCode 12.3 2021-01-19 20:41:39 -08:00
John Ericson
19852e3dc6
Merge pull request #104648 from samueldr/cleanup/kernelMajor
platforms.nix: Remove now unused kernelMajor
2021-01-18 14:08:30 -05:00
Jan Tojnar
2a5b2df11d
Merge pull request #107417 from jtojnar/deprecate-unclear-gpl-licenses
licenses: Mark unclear GPL licenses explicitly deprecated
2021-01-01 23:49:44 +01:00
John Ericson
15cb12178a
Merge pull request #107999 from andir/platforms-arm-trusted-platform
lib/systems/platforms: treat missing cpu version as generic pcBase
2020-12-31 13:52:09 -05:00
Ben Siraphob
b77ca83282 lib/systems: add emulator for mmix 2020-12-31 13:22:12 +07:00
Andreas Rammhold
a44aec2b1b
lib/systems/platforms: treat missing cpu version as generic pcBase
Since 40e7be1 all ARM platforms that didn't have a parsed cpu version
(e.g. arm-none-eabi) would be handled as armv7l-hf-multiplatform which
did break building arm-trusted-platform packages for some targets (e.g.
rk3399).

Using pcBase as fallback, instead of armv7l-hf-multiplatform,
corresponds with the behaviour we had before 40e7be1.
2020-12-31 00:12:07 +01:00
Fabián Heredia Montiel
2a9ac172c1 lib.systems: update processor architecture info 2020-12-23 18:57:59 -06:00
Jan Tojnar
9d5bd8b835
licenses: Mark unclear GPL licenses explicitly deprecated
We recently switched to more explicit GPL license names in line
with the SPDX change and GNU Foundation recommendations:
https://www.gnu.org/licenses/identify-licenses-clearly.html

This followed up older change to use the recommended SPDX ID
18a5e8c36b
but using the `-only` variant for these deprecated licenses too
makes it harder to check for them automatically.

Let’s switch to the appropriate SPDX ID again.
2020-12-22 19:25:33 +01:00
Linus Heckemann
b1fc183639
Merge pull request #97145 from lheckemann/initrd-improvements
Initrd improvements
2020-12-18 18:15:27 +01:00
Silvan Mosberger
9e6737710c Revert "Module-builtin assertions, disabling assertions and submodule assertions" 2020-12-18 16:44:37 +01:00
Silvan Mosberger
7698aa9776
Merge pull request #97023 from Infinisil/module-assertions
Module-builtin assertions, disabling assertions and submodule assertions
2020-12-18 14:17:52 +01:00
Doron Behar
15edb396ca
Merge pull request #104118 from LibreCybernetics/add-parity-license
lib.licenses: add Parity-7.0.0 license
2020-12-18 11:55:21 +02:00
Silvan Mosberger
a6a70d14a9
lib/modules: Prefix mkRemovedOptionModule & co. check names
To avoid name clashes

Co-authored-by: Robert Hensing <robert@roberthensing.nl>
2020-12-18 03:34:39 +01:00
Silvan Mosberger
767d80099c
lib/modules: Introduce _module.checks.*.check
Previously the .enable option was used to encode the condition as well,
which lead to some oddness:
- In order to encode an assertion, one had to invert it
- To disable a check, one had to mkForce it

By introducing a separate .check option this is solved because:
- It can be used to encode assertions
- Disabling is done separately with .enable option, whose default can be
  overridden without a mkForce
2020-12-17 21:52:24 +01:00
Linus Heckemann
2ee35e1fce lib/systems: fix kernelArch for x86_64
IA64 (Itanium) is something completely different and certainly not
what we want! x86_64 code lives in arch/x86 just like "classic" x86.
2020-12-17 11:10:38 +01:00
Sandro
8c321dd36b
Merge pull request #101248 from makefu/pkgs/pfsshell/init 2020-12-08 05:38:25 +01:00
Alex Brandt
ff1700feda lib/string: drop redundant string in description of toInt.
Describing the string argument as a string is redundant and not needed
to describe what this function does.
2020-12-05 14:35:30 +00:00
Alex Brandt
4a5cb363ae lib/strings: fix typo in example
The example refers to a snake_case function name but Nix uses camelCase
function names.  This ensures the example is correct for the given
function.
2020-12-04 19:35:27 +00:00
Alex Brandt
2697a777e7 lib/strings: fix examples for enableFeatureAs
The As was missing in the examples on this library function.  This will
ensure the examples refer to the function they document.
2020-12-03 18:50:14 +00:00
John Ericson
8e21ce5fae
Merge pull request #105294 from Ericson2314/platform-config-improvements
Platform config improvements
2020-12-02 11:17:41 -05:00
John Ericson
b1d16d8101
Merge pull request #105432 from tadfisher/remarkable-2-cross
Cross-compile configuration for reMarkable 2 tablet
2020-12-01 16:51:51 -05:00
makefu
a8de2e3fb5
licenses: Add Academic Free License version 2.0 2020-12-01 11:16:44 +01:00
Silvan Mosberger
991dfccbd1
lib/modules: _module.check should always be internal
Honestly this option should probably just be removed
2020-11-30 23:51:42 +01:00
Silvan Mosberger
8dea4df903
lib/modules: Remove _module.checks.*.triggerPath as it's not necessary
Previously this option was thought to be necessary to avoid infinite
recursion, but it actually isn't, since the check evaluation isn't fed
back into the module fixed-point.
2020-11-30 23:51:42 +01:00
Silvan Mosberger
c9cc8969b4
lib/modules: Rename _module.assertions to _module.checks 2020-11-30 23:51:41 +01:00
Silvan Mosberger
3e39d6efdf
lib/tests: Add tests for module-builtin assertions 2020-11-30 23:51:23 +01:00
Silvan Mosberger
900c4a5abd
lib/tests: Implement generalized checkConfigCodeOutErr for module tests 2020-11-30 23:51:23 +01:00
Silvan Mosberger
3759a77fcd
nixos/modules: Expose the internal module in the top-level documentation 2020-11-30 23:51:23 +01:00
Silvan Mosberger
1e6a84b7af
nixos/modules: Allow options to be coerced to a string for convenience 2020-11-30 23:51:23 +01:00
Silvan Mosberger
20131348db
lib/modules: Use module-builtin assertions for mkRemovedOptionModule and co. 2020-11-30 23:51:23 +01:00
Silvan Mosberger
9523df7eb6
nixos/assertions: Use module-builtin assertion implementation 2020-11-30 23:51:22 +01:00
Silvan Mosberger
df5ba82f74
lib/modules: Implement module-builtin assertions
This implements assertions/warnings supported by the module system directly,
instead of just being a NixOS option (see
nixos/modules/misc/assertions.nix).

This has the following benefits:
- It allows cleanly redoing the user interface. The new
  implementation specifically allows disabling assertions or
  converting them to warnings instead.
- Assertions/warnings can now be thrown easily from within
  submodules, which previously wasn't possible and needed workarounds.
2020-11-30 23:51:19 +01:00
Silvan Mosberger
0b61ed7af9
lib/options: Don't show internal suboption in the manual
Initially https://github.com/NixOS/nixpkgs/pull/82897 prevented
non-visible options from being rendered in the manual, but
visible-but-internal options were still being recursed into. This fixes
this, aligning the recurse condition here with the one in
make-options-doc/default.nix
2020-11-30 22:51:34 +01:00
Silvan Mosberger
e08182020c
Merge pull request #99115 from Infinisil/toString-module-files
lib/modules: Make sure to not import module _file's into the store
2020-11-30 21:00:59 +01:00