Commit Graph

3343 Commits

Author SHA1 Message Date
Robert Hensing
73f584c3cc lib/modules.nix: Deduplicate documentation
`file://./..` looks redundant, but makes the url clickable in vscode.
2023-05-06 18:32:58 +02:00
Robert Hensing
84b1b01702 lib/modules: Only interpret class declaration in non-shorthand mode
This is to avoid stealing keys from submodules. `class` might be
common enough that reinterpreting existing `class` attributes in
configurations as a declaration leads to fairly widespread problems.
2023-05-06 18:29:04 +02:00
Robert Hensing
1f4a58ef03 lib/modules.nix: Refactor: extract applyModuleArgs 2023-05-06 18:29:04 +02:00
Robert Hensing
06ca78663c lib/modules.nix: Refactor: evaluate applyModuleArgsIfFunction in attrs case 2023-05-06 18:29:04 +02:00
Robert Hensing
439f6790bd lib/modules.nix: Restore old collectModules interface 2023-05-06 18:29:04 +02:00
Robert Hensing
9714487f74 lib/modules: Explain that a configuration can't be loaded as a module 2023-05-06 18:29:04 +02:00
Robert Hensing
2e689d58cb lib/modules: Improve error when a configuration is imported
This is appears to be a fairly common mistake for beginners who want
to build larger things from the system configurations, such as NixOps
networks, etc. Further explanation seems appropriate.
2023-05-06 18:29:03 +02:00
Robert Hensing
58f385f680 lib/modules: Check against importing things with a _type 2023-05-06 18:29:03 +02:00
Robert Hensing
b8ff2807a2 lib/modules: Add class concept to check imports
This improves the error message when an incompatible module is
imported.
2023-05-06 18:29:03 +02:00
Robert Hensing
3633bf98be lib/modules.nix: Make some functions private
The supposedly public nature of these functions has been holding
back module system maintenance, while usages of these functions
are expected to be rare. If used anywhere, presumably they're
emulating module system behavior because some use case isn't supported
properly. We should try to support such a use case directly, if it
even exists.
2023-05-06 18:29:03 +02:00
Robert Hensing
fe15279390 lib/modules.nix: Use explicit exports 2023-05-06 18:22:51 +02:00
Robert Hensing
e7e64233c9 lib/tests/modules.sh: Unload implicit modules
I had some trouble understanding this. Let's try to keep new tests
a bit more stateless and explicit.
2023-05-06 18:22:50 +02:00
toonn
e31c8b22dd
Merge pull request #223407 from AngryAnt/toplist-path
lib.toPlist: Add support for path values
2023-05-05 21:15:23 +02:00
Weijia Wang
1348f199a5 lib/systems: move loongarch64-linux out of mips block 2023-05-04 09:52:01 +03:00
Matthieu Coudron
8670e496ff
Merge pull request #227714 from ony/feature/generateLuarocksConfig-toLua
lua.lib: use toLua in generateLuarocksConfig
2023-05-01 18:53:22 +02:00
Alyssa Ross
12e08bd339 lib.kernel.unset: init
Previously, there was no way to unset an option when overriding a
kernel, apart from writing out the attrset yourself.  Now it's
possible with lib.mkForce lib.kernel.unset.  It's important to be able
to do this, because setting an option in the override may cause other
options to become unused, which would fail the config build unless
they were overridden too.
2023-05-01 10:23:42 +00:00
Mykola Orliuk
7287c0e076 lib.generators.toLua: asBindings option
Allows to generate code block for setting of global variables
2023-04-29 19:26:35 +02:00
Weijia Wang
b2ef7956b6
Merge pull request #227560 from jackyliu16/loongnix-commit
lib.platforms.loongarch64: init
2023-04-28 13:21:42 +03:00
jackyliu16
edcad332d9 lib.platforms.loongarch64: init 2023-04-27 20:04:30 +03:00
Adam Joseph
ed65f784a7
Merge pull request #191995 from amjoseph-nixpkgs/lib/systems/inspect/comment
lib/systems/inspect.nix: explanatory comment
2023-04-24 02:21:36 +00:00
Matthieu Coudron
377b6c7bc1
Merge pull request #225496 from ony/feature/generators-toLua
lib/generators: add toLua/mkLuaInline
2023-04-23 20:45:01 +02:00
Mykola Orliuk
e9b416168a lib.generators.toLua: allow disabling multiline 2023-04-23 19:46:14 +02:00
Mykola Orliuk
a48fd10c86 lib.generators.toLua: tune comment for noogle use
See https://github.com/nix-community/noogle
2023-04-23 19:46:13 +02:00
Mykola Orliuk
4ec4c6fda9 lib/generators: add toLua/mkLuaInline
Suitable to simplify Lua-based configurations like neovim-lspconfig that
might need to interpolate Nix package paths.
2023-04-23 01:07:58 +02:00
Artturin
06e8d82e9c lib/systems: disable docs in qemu-user
45M -> 31M
2023-04-22 00:38:56 +03:00
zimbatm
ad0b21fbbc
lib: add missing removeAttrs builtin
I'm expecting all the builtins.* functions to be available in lib.*
2023-04-19 21:27:38 +02:00
Silvan Mosberger
4f35a58184
Merge pull request #221204 from tweag/deprecate-paths-to-strings
lib.strings: Prevent paths as inputs in some functions
2023-04-04 18:35:06 +02:00
Naïm Favier
0d5c1ac149
Merge pull request #222516 from ncfavier/options-better-error
lib/modules: better error for invalid option declarations
2023-04-04 10:42:14 +02:00
Mario Rodas
c937feb1a1
Merge pull request #219826 from noctarius/master
Fixed TimescaleDB License Information
2023-04-01 09:19:04 -05:00
Emil "AngryAnt" Johansen
e932e98437
lib.toPlist: keep test output in external files for their tab indents 2023-03-27 19:25:52 +02:00
Emil "AngryAnt" Johansen
63a8c43d09
lib.toPlist: basic test coverage 2023-03-27 19:25:38 +02:00
Emil "AngryAnt" Johansen
03ceb367b7
lib.toPlist: support for path values 2023-03-27 16:25:25 +02:00
Cole Helbling
d9f767600f lib/customisation: callPackageWith should abort with errors
ofborg relies on the behavior that existed prior to
1c00bf3948, where evaluation would
immediately abort due to a missing argument (whether it be an aliased
package when `allowAliases = false;` or a typo'd or otherwise
nonexistent package).

If `callPackageWith` `throw`s instead of `abort`s, the following
`nix-env` invocation does not fail fast but instead silently skips the
attribute (assuming there is a package that has an aliased package in
its `autoArgs`):

    $ nix-env -qa --json --file . --arg config '{ allowAliases = false; }' &>/dev/null
    $ echo $?
    0

This does change the error output when there is a missing package (for
any of the reasons mentioned above), though. Before this change, the
errors looked like this:

    $ nix-build -A hello --arg config '{ allowAliases = false; }'
    error:
           … while calling the 'throw' builtin

             at /home/vin/workspace/vcs/nixpkgs/master/lib/customisation.nix:179:65:

              178|
              179|     in if missingArgs == [] then makeOverridable f allArgs else throw error;
                 |                                                                 ^
              180|

           error: Function called without required argument "bash_5" at /home/vin/workspace/vcs/nixpkgs/master/pkgs/applications/misc/hello/default.nix:8, did you mean "bash" or "bashdb"?

And the errors now look like this:

    $ nix-build -A hello --arg config '{ allowAliases = false; }'
    error:
           … while calling the 'abort' builtin

             at /home/vin/workspace/vcs/nixpkgs/master/lib/customisation.nix:179:65:

              178|
              179|     in if missingArgs == [] then makeOverridable f allArgs else abort error;
                 |                                                                 ^
              180|

           error: evaluation aborted with the following error message: 'Function called without required argument "bash_5" at /home/vin/workspace/vcs/nixpkgs/master/pkgs/applications/misc/hello/default.nix:8, did you mean "bash" or "bashdb"?'
2023-03-24 14:22:11 -07:00
Christoph Engelbert (noctarius)
4f7f469c82
timescaledb: Fixed the licensing for the timescaledb package to be split into TSL (Timescale Community License) and Apache 2.0 components.
TimescaleDB provides two types of licenses, Apache 2.0 and Timescale Community License (TSL), with different feature sets. While all the code is in the same repository, the build
system can build both versions depending on the build parameters set in.

Co-authored-by: Emily Lange <git@indeednotjames.com>
2023-03-24 11:12:12 +01:00
Naïm Favier
8751764236
lib/modules: better error for invalid option declarations
Make `byName` aware of whether it's processing options or config to give
slightly more accurate error messages.
2023-03-22 12:37:28 +01:00
Bernardo Meurer
6e55733359
Merge pull request #219747 from Stunkymonkey/deprecate-isNull 2023-03-16 11:10:22 -03:00
Silvan Mosberger
61012f6daf lib.strings.remove{Prefix,Suffix}: Deprecate for path prefix/suffix arguments
See also parent commits
2023-03-15 19:51:38 +01:00
Silvan Mosberger
5e8b9de728 lib.strings.normalizePath: Deprecate for path values
There's no need to call this function on path data types, and it's
confusing with the new lib.path library functions
2023-03-15 19:42:45 +01:00
Silvan Mosberger
99bc90e301 lib.strings: Deprecate path prefix/suffix/infix arguments
lib.{hasPrefix,hasInfix,hasSuffix} would otherwise return an
always-false result, which can be very unexpected:

    nix-repl> lib.strings.hasPrefix ./lib ./lib/meta.nix
    false
2023-03-15 19:42:43 +01:00
Silvan Mosberger
b611afeb74
Merge pull request #209099 from infinisil/lib.path.subpath.join
lib.path.subpath.join: init
2023-03-14 20:47:47 +01:00
sternenseemann
755c177ff9
Merge pull request #219027 from NixOS/haskell-updates
haskellPackages: update stackage and hackage; haskellPackages.ghc: 9.2.6 -> 9.2.7
2023-03-13 11:36:33 +01:00
hsjobeki
15a8d05ba5 init: lib.foldlAttrs
- provide comprehensive example
- add unit test
2023-03-11 10:42:00 +01:00
github-actions[bot]
bf7ad8aa57
Merge master into haskell-updates 2023-03-10 00:14:11 +00:00
Alyssa Ross
bc7d355dc0 lib.systems: don't try to emulate s390-linux
We don't have an emulator that can do this.
2023-03-09 19:25:23 +00:00
Robert Hensing
6b79fe8cdc
Merge pull request #211855 from hercules-ci/lib-modules-disabledModules-module-with-key
lib/modules: Allow an "anonymous" module with key in disabledModules
2023-03-09 16:16:37 +01:00
github-actions[bot]
4bda2ab514
Merge master into haskell-updates 2023-03-09 00:13:40 +00:00
sternenseemann
471b9cab41 haskell.compiler.ghcHEAD: 9.7.20221224 -> 9.7.20230217
- Christmas is over!

- Upstream has changed the name of the target triplet used for the JS
  backend from js-unknown-ghcjs to javascript-unknown-ghcjs, since Cabal
  calls the architecture "javascript":
  6636b67023

  Since the triplet is made up anyways, i.e. autoconf does not support
  it and Rust uses different triplets for its emscripten backends, we'll
  just change it as well.

- Upstream fixed the problem with ar(1) being invoked incorrectly by stage0:
  e987e345c8
2023-03-08 17:12:18 +01:00
Sandro
7f917aebcd
Merge pull request #214941 from OPNA2608/init/katawa-shoujo
katawa-shoujo: init at 1.3.1
2023-03-08 11:13:54 +01:00
pennae
61852b7faa lib: remove deprecated functions
all of these have been deprecated and raising warnings since 18.09. it's
about time we actually made good on "will be removed in the next release".
2023-03-08 03:57:38 +01:00
Atemu
19e81a9269
Merge pull request #211950 from Atemu/armv8-no-more-armv7
lib/systems/parse: stop considering armv8a able to execute armv7l
2023-03-07 19:25:32 +01:00