1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00
Commit graph

3612 commits

Author SHA1 Message Date
Alyssa Ross 91488fb6db
lib.systems: remove (accidental?) rust/rustc alias
I imagine this was supposed to be rustc = args.rustc, like the other
two lines.  This meant that we accepted both rust and rustc
attributes, with the same effect.  I doubt anybody was using the
undocumented, probably-accidental "rust" spelling, but we should
remove it before somebody starts.

In fact, we don't need to set rustc here at all, because no value
platforms.select could return will ever include a rustc key (unlike
the other two), so then rustc will be filled in later, when args is
merged into final.
2023-05-09 17:49:05 +00:00
Adam Joseph 89325a10b0
Merge pull request #228013 from amjoseph-nixpkgs/pr/qemuArch/mips
lib/systems: add mips64[el] entries to qemuArch
2023-05-09 06:39:13 +00:00
Naïm Favier 6674b8a6f1
Merge pull request #230353 from ncfavier/defaultText-only
lib/options: fix rendering of options with only a defaultText
2023-05-08 14:38:35 +02:00
github-actions[bot] 3510094ebe
Merge master into staging-next 2023-05-07 00:02:36 +00:00
Robert Hensing eab660d91e lib.modules: configurationClass -> class
This simplifies the documentation. `configuration` is implied by `_type`.
2023-05-06 18:32:59 +02:00
Robert Hensing 89491bef8d lib.modules: in evalModules return move _module.class -> configurationClass 2023-05-06 18:32:59 +02:00
Robert Hensing fd88c79418 lib.modules: Change class declaration in module to _class 2023-05-06 18:32:59 +02:00
Robert Hensing 7459c02495 lib/tests/modules.sh: Add submodule + class tests 2023-05-06 18:32:59 +02:00
Robert Hensing 8054785157 lib/modules: Move class out of specialArgs 2023-05-06 18:32:58 +02:00
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
Naïm Favier 7cd5b9a6e8
lib/options: fix rendering of options with only a defaultText
Some options have their default value set in the `config` instead of
`default`, for example to push `mkDefault`s down an attribute set.
In those cases, it's useful to provide a `defaultText` for informational
purposes.
2023-05-06 17:09:10 +02:00
github-actions[bot] f62c3cbbdc
Merge master into staging-next 2023-05-06 00:02:06 +00: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
github-actions[bot] bf19e21376
Merge master into staging-next 2023-05-04 12:01:18 +00:00
Weijia Wang 1348f199a5 lib/systems: move loongarch64-linux out of mips block 2023-05-04 09:52:01 +03:00
github-actions[bot] 7783054bd0
Merge staging-next into staging 2023-05-01 18:01:56 +00: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
github-actions[bot] cff4be2a2b
Merge staging-next into staging 2023-05-01 12:01:54 +00: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
github-actions[bot] e1fd5ee13e
Merge staging-next into staging 2023-04-28 12:01:49 +00:00
Weijia Wang b2ef7956b6
Merge pull request #227560 from jackyliu16/loongnix-commit
lib.platforms.loongarch64: init
2023-04-28 13:21:42 +03:00
Alyssa Ross e5d1511d5b lib.systems: allow specifying libc = null
It makes sense to allow platform definitions to opt out of having libc
at all.  One use case would be targetting some obscure new Linux
target that doesn't have a libc implementation yet, and another is
UEFI, which is basically libc-less Windows.

Not having libc is not commonly specified in (GNU) triples (even
Linux's build system will just target either -gnu or -musl depending
on the platform), so instead, we use a separate attribute for it.
2023-04-28 10:01:22 +00:00
jackyliu16 edcad332d9 lib.platforms.loongarch64: init 2023-04-27 20:04:30 +03:00
Adam Joseph 7001445909 lib/systems: add mips64[el] entries to qemuArch
This commit adds `mips64el` to the `qemuArch` table.
2023-04-24 13:17:45 -07: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 866f75e5b9 lib.path.append: Add a law
With removePrefix introduced in a future commit this law can then be
used to derive

        removePrefix p (append p s) == subpath.normalise s
        => (wrap with append)
        append p (removePrefix p (append p s)) == append p (subpath.normalise s)
        => (append is not influenced by subpath normalisation)
        append p (removePrefix p (append p s)) == append p s
        => (substitute q = append p s)
        append p (removePrefix p q) == q

Not included in the docs because it's not that important, just shows
that the first statement is more general than the second one (because
this derivation doesn't work the other way)
2023-04-05 20:27:46 +02:00
Silvan Mosberger c701a4dd29 lib.sources.pathType and co.: Move to lib.filesystem
These functions only work with the filesystem, they don't import
anything as sources
2023-04-05 17:18:10 +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
Felix Buehler d10e69c86b treewide: deprecate isNull
https://nixos.org/manual/nix/stable/language/builtins.html#builtins-isNull
2023-03-06 22:40:04 +01:00
Sandro 5a695ebb77
Merge pull request #210125 from OPNA2608/fix/pdisk_patchurl 2023-03-05 18:09:01 +01:00
pennae f0e8db002b lib/options: fix mkPackageOption docs
nixdoc takes everything from Type: to Example: as the type, which
misrendered a large part of the docs. it also drops sorely needed spaces
where the type had line breaks, so all has to be on one line (or use
non-standard literal spaces, which is probably worse).

also clarify what the `?` for arguments mean while we're here.
2023-03-05 01:21:46 +01:00
Naïm Favier a342ebe166
lib/strings: hide asciiTable
Since it's an attribute set, the lib function location generating code
tries to generate locations for each of the characters...
2023-03-04 13:20:49 +01:00
Valentin Gagarin 61cf0b2166
Merge pull request #219235 from patwid/strings-escape-query-for-url-encoding 2023-03-04 12:38:57 +01:00
Patrick Widmer 7089294f10 strings: add escapeQuery for url encoding 2023-03-03 20:48:55 +01:00
Robert Hensing 118bdf25a6 lib/modules: Allow an "anonymous" module with key in disabledModules
This makes the following work

    disabledModules = [ foo.nixosModules.bar ];

even if `bar` is not a path, but rather a module such as

    { key = "/path/to/foo#nixosModules.bar"; config = ...; }

By supporting this, the user will often be able to use the same syntax
for both importing and disabling a module. This is becoming more relevant
because flakes promote the use of attributes to reference modules. Not
all of these modules in flake attributes will be identifiable, but with
the help of a framework such as flake-parts, these attributes can be
guaranteed to be identifiable (by outPath + attribute path).
2023-03-01 15:03:44 +01:00
github-actions[bot] 399e2c78d4
Merge master into staging-next 2023-02-26 06:01:09 +00:00
Anselm Schüler 9769e90233 lib/options: Add more options to mkPackageOption 2023-02-26 03:00:22 +01:00
github-actions[bot] 4688cd53b6
Merge master into staging-next 2023-02-23 18:01:15 +00:00
Alyssa Ross 7ce8e7c4cf lib.licenses.asl20-llvm: replace llvm-exception
LLVM-exception only makes sense when used with the Apache 2.0 license,
so let's combine them, so it's not possible to forget one of them like
happened with llvm_15.
2023-02-23 17:42:15 +00:00
github-actions[bot] 390b789c39
Merge master into staging-next 2023-02-23 12:01:07 +00:00
hsjobeki 09ee6241b5 improves: comprehensiveness 2023-02-23 11:24:47 +01:00
hsjobeki 70c36dcfb8 add better documentation comments to lib.runTests 2023-02-23 10:21:58 +01:00
github-actions[bot] fd8dd0c966
Merge master into staging-next 2023-02-21 18:01:08 +00:00
Naïm Favier f77c364def
Merge pull request #216983 from ncfavier/showOption-comment
lib/options: update showOption comment
2023-02-21 16:31:07 +01:00
Naïm Favier 6c7d4d4f9d
lib/options: update showOption comment 2023-02-18 18:13:11 +01:00
github-actions[bot] bf5abe92d4
Merge master into staging-next 2023-02-15 18:01:14 +00:00
Sandro d05e6727a2
Merge pull request #203539 from SuperSandro2000/architectures-expand-inferiors
lib/systems/architectures: expand inferiors
2023-02-15 16:27:00 +01:00
Silvan Mosberger 1a2c2846b0 lib.path.subpath.join: init
This function can be used to safely join subpaths together
2023-02-13 14:01:17 +01:00
github-actions[bot] 0417b0e54f
Merge staging-next into staging 2023-02-10 00:03:00 +00:00
Domen Kožar 844a738b1f
Merge pull request #215455 from domenkozar/module-errors
nixos: Improve module conflict error messages
2023-02-10 02:42:28 +07:00
OPNA2608 235d9e2187 lib/licenses.nix: Add cc-by-nc-nd-30 2023-02-09 15:50:20 +01:00
Domen Kožar fe734efc9c types: suggest how to resolve the conflict 2023-02-09 08:24:12 +00:00
Domen Kožar b3cc29c288 types: explicitly state unique options are expected to be unique 2023-02-09 07:25:50 +00:00
github-actions[bot] 371c2a6303
Merge staging-next into staging 2023-02-07 18:02:15 +00:00
markuskowa 5cf138823d
Merge pull request #214930 from sheepforce/nwchem
nwchem: init at 7.0.2
2023-02-07 17:30:02 +01:00
Silvan Mosberger a770c0393c
Merge pull request #208887 from tweag/lib.path.append
lib.path.append: init
2023-02-07 17:27:37 +01:00
Phillip Seeber acb812207f lib/licenses: add ecl20 2023-02-07 10:39:46 +01:00
github-actions[bot] 99cce0e1f1
Merge staging-next into staging 2023-02-07 06:02:00 +00:00
Silvan Mosberger 0a60663e67
Merge pull request #206611 from h7x4/lib-lists-add-repeat
lib.lists: add `replicate`
2023-02-07 06:16:09 +01:00
github-actions[bot] d3648def80
Merge staging-next into staging 2023-02-07 00:02:46 +00:00
Bernardo Meurer 7b7b6c248c
Merge pull request #214856 from vamega/bencode-py 2023-02-06 15:58:58 -05:00
h7x4 7c4abbf80e
lib.lists: add replicate
`replicate` returns n copies of an element as a list.

Co-Authored-By: Silvan Mosberger <contact@infinisil.com>
2023-02-06 20:40:47 +01:00
Varun Madiath dedb550ce6 bencode-py: init at 4.0.0 2023-02-06 12:14:15 -05:00
Artturi dcc7df7fe6
Merge pull request #211685 from Artturin/splicingstuff1-split 2023-02-03 12:49:08 +02:00
Silvan Mosberger 50e4dbf35b
Merge pull request #205557 from ncfavier/concatLines
lib/strings: add `concatLines`
2023-01-31 18:05:53 +01:00
Silvan Mosberger 96d4702261
Merge pull request #213650 from urandom2/libdoc
lib: standardise attrset type syntax
2023-01-31 16:20:56 +01:00
github-actions[bot] dd1ff149da
Merge master into staging-next 2023-01-31 00:02:31 +00:00
Colin Arnott 6ff66fcbd7
lib: standardise attrset type syntax
There are a number of different syntaxes used for attrset type
signatures in our doc strings, this change standardises upon one that
uses :: for specifying attribute type, and ; terminators to be
consistent with nix syntax. There are no bugs in the functions
themselves, just that different syntaxes may confuse new users.
2023-01-30 23:53:44 +00:00
Florian Klink 31931ffc35
Merge pull request #212939 from amjoseph-nixpkgs/pr/isStatic
meta: replace predicates with pattern over elaborated platform
2023-01-30 21:13:15 +01:00
Alyssa Ross aa51704ba5
lib.systems.inspect.patterns.isEfi: drop ARMv5
I'm not aware of any ARMv5 EFI implementation.  gnu-efi doesn't
support it, so the build of systemd for armv5tel-linux is broken if
it's isEfi.
2023-01-30 19:54:06 +00:00
Robert Hensing 663c41affd
Merge pull request #212282 from hercules-ci/pkg-config-packages
defaultPkgConfigPackages: init
2023-01-30 09:48:53 +01:00
Robert Hensing 473ac9692e lib.hydraJob: Tolerate null
By allowing null, we allow code to avoid filterAttrs, improving
laziness in real world use cases.
Specifically, this strategy prevents infinite recursion errors,
performance issues and possibly other errors that are unrelated to
the user's code.
2023-01-30 00:35:34 +01:00
Alyssa Ross 4f8a5065d7
lib.systems.inspect.patterns.isEfi: remove "aarch64"
There is no "aarch64" CPU family — it counts as "arm", as can be seen
from the definition of isAarch64 above.

Checked that stdenv.hostPlatform.isEfi is still true on aarch64-linux.
2023-01-29 16:29:47 +00:00
Naïm Favier 0288ee587f
maintainers: clarify what fields are required 2023-01-27 18:05:28 +01:00
Naïm Favier 93dc2de29a
maintainers: disallow noreply.github.com emails 2023-01-27 18:05:28 +01:00
Naïm Favier 4e39849611
maintainers: make email optional
Not giving an email address is fine as long as the maintainer is
reachable through other means, such as GitHub or Matrix.
2023-01-27 18:04:20 +01:00
Adam Joseph 9c0a3417c8
Update lib/systems/inspect.nix
Co-authored-by: Naïm Favier <n@monade.li>
2023-01-27 11:56:20 +00:00
Adam Joseph 009a3f1857
Update lib/systems/inspect.nix
Co-authored-by: Naïm Favier <n@monade.li>
2023-01-27 11:16:35 +00:00
Adam Joseph 435618d9b3
Update lib/meta.nix
Co-authored-by: Naïm Favier <n@monade.li>
2023-01-27 11:16:29 +00:00
Adam Joseph 6f942d4a17
Update lib/meta.nix
Co-authored-by: Naïm Favier <n@monade.li>
2023-01-27 11:16:19 +00:00
Adam Joseph ea0bcf2505 lib/systems/inspect.nix: add platformPatterns.isStatic 2023-01-27 02:21:23 -08:00
Adam Joseph 1690aa6858 lib/meta.nix: allow patterns over entire platform, not just .parsed 2023-01-27 02:19:30 -08:00
Adam Joseph 778419b9e6 Revert "lib/meta.nix: platformMatch: allow predicate functions"
This reverts commit b7d097438b.
2023-01-27 01:49:39 -08:00
Robert Hensing 683887a79c
Merge pull request #212189 from amjoseph-nixpkgs/pr/lib/mapAttrsRecursive/comment
attrsets: clarify that mapAttrs maps over *leaf* attrs
2023-01-25 10:18:38 +01:00
Adam Joseph a4e3e16258
Update lib/attrsets.nix
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-01-25 02:52:54 +00:00
Pascal Wittmann 353e2d957c
Merge pull request #212408 from raboof/imapsync-fix-license
imapsync: fix license
2023-01-24 11:29:22 +01:00
Arnout Engelen 9b79245235
licenses: add NLPL 2023-01-24 11:24:04 +01:00
Sandro 9441b22187
Merge pull request #209769 from LoveIsGrief/simple-dlna-browser 2023-01-23 23:52:58 +01:00
Adam Joseph ee00af7a32 attrsets: clarify that mapAttrs maps over *leaf* attrs 2023-01-22 15:19:09 -08:00
Adam Joseph b7d097438b lib/meta.nix: platformMatch: allow predicate functions 2023-01-22 00:27:19 -08:00
Atemu 44e5b41871 lib/systems/parse: stop considering armv8a able to execute armv7l
In the past, most (if not all) armv8 CPUs could also execute armv7. However,
with the advent of Apple Silicon, aarch64 CPUs without any aarch32 capabilities
are now wide-spread among users.
2023-01-21 16:28:49 +01:00
Robert Hensing 5b2f597b11 lib.extendDerivation: Fix interaction between output selection and overrideAttrs 2023-01-20 02:45:34 +02:00
Robert Hensing a1b2177ec4
Merge pull request #210976 from clhodapp/fix/extensible-sets
lib: make extender available on self-references
2023-01-20 01:08:16 +01:00
John Ericson c1071e7804
Merge pull request #211622 from alyssais/valgrind-platforms
valgrind: make meta.platforms more accurate
2023-01-19 15:43:22 -05:00
Alyssa Ross 6d165a9474
lib.platforms.s390x: init 2023-01-19 17:43:50 +00:00
Alyssa Ross 541a2a5e91
lib.platforms.power: init 2023-01-19 17:43:49 +00:00
Alyssa Ross 48f3fd2d49
lib.platforms.armv7: init 2023-01-19 17:43:41 +00:00
Silvan Mosberger eac2538707 lib.path.append: init
This function can be used to append strings to Nix path values in a
safe way.
2023-01-18 20:17:31 +01:00
Silvan Mosberger 5c4f616198 lib.path: Minor improvements
- Use isValid when possible instead of subpathInvalidReason: https://github.com/NixOS/nixpkgs/pull/209099#discussion_r1068714681
- Add documentation to function arguments
- Use newlines for error messages: https://github.com/NixOS/nixpkgs/pull/208887#discussion_r1069737602
- Add short comments for the unit test groups: https://github.com/NixOS/nixpkgs/pull/208887#discussion_r1072913051
- Slight formatting improvement for laws: https://github.com/NixOS/nixpkgs/pull/209099#discussion_r1068707955
2023-01-18 18:19:17 +01:00
Robert Hensing 415504e867 lib/tests/release.nix: Make nix a parameter + strictDeps
This makes bisecting nix a bit easier.

Example reproducer, invoked from nix directory:

```bash
nix-build ../nixpkgs/lib/tests/release.nix --arg nix '(builtins.getFlake "git+file://${toString ./.}").packages.x86_64-linux.default'
```
2023-01-18 01:39:38 +01:00
OPNA2608 991a22a7d0 licenses: Remove unnecessary archive.org link for APSL-1.0
SPDX has a copy of it, and the url gets overridden with the spdx.org one anyway.
2023-01-17 12:10:41 +01:00
Chris Hodapp 06f0e49dc6 lib: make extender available on self-references 2023-01-15 11:34:05 -08:00
Nick Cao 35bede2be5
Merge pull request #184521 from dramforever/riscv-isefi
lib/systems/inspect.nix: Add riscv to isEfi
2023-01-13 14:28:11 +08:00
Adam Joseph 098c6b0bec check-meta(hasUnsupportedPlatform): use lib.meta.availableOn
`hasUnsupportedPlatform` was not updated with #37395, so it does not
understand attrsets in `meta.[bad]platforms`.  In particular,
attrsets in `meta.badPlatforms` will "fail open" and be ignored.

Let's use `lib.meta.availableOn` instead of duplicating its logic.

Thanks to @alyssais for [noticing][1].

[1][https://github.com/NixOS/nixpkgs/pull/194148#discussion_r990817610]

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2023-01-11 19:31:52 +00:00
Adam Joseph 0b90e548b5 lib/meta(availableOn): handle missing meta and empty meta.platform 2023-01-11 19:31:52 +00:00
LoveIsGrief 346b939a09
lib/licenses add Fair license 2023-01-10 23:10:24 +01:00
Artturi 6ce54982ec
Merge pull request #209974 from amjoseph-nixpkgs/pr/close/209952 2023-01-10 18:33:27 +02:00
Silvan Mosberger 041b044a66 lib/path/tests: Fix property tests when "-n" is generated
When "-n" is generated by the property tests, it causes `echo` to not
output the string since it's interpreted as an option. Apparently
there's no good way to print "-n" with `echo` [1], so switching to
`printf` instead

[1]: https://unix.stackexchange.com/questions/85846/how-can-i-print-n-with-echo
2023-01-10 14:18:35 +01:00
Adam Joseph 06939ff3de add mipsisa{32,64}r6[el], closes 209952 2023-01-09 16:04:16 -08:00
Naïm Favier fb1bc8de93
lib/modules: make mkAliasOptionModule emit DocBook
Follow-up to https://github.com/NixOS/nixpkgs/pull/208407

Removing `mdDoc` isn't enough, we need to emit actual DocBook.
2023-01-08 22:44:18 +01:00
Silvan Mosberger d35cae9696
Merge pull request #208674 from YoshiRulz/yoshi-lib-docs
lib: Fix mismatched quotes in `lib.*` doc comments
2023-01-05 19:00:38 +01:00
pennae e912c7bfe9 lib/modules: hide _module.args docs
unfortunately we can't unconditionally make this text markdown without
impacting downstream users of docs generation (as noted in #175586).
hide it entirely until the transition is complete.
2023-01-05 02:33:13 +01:00
pennae 9da5f12ecf modules: add mkPackageOptionMD
another transitional option factory, like mkAliasOptionModuleMD.
2023-01-05 02:33:13 +01:00
pennae 4c1cfbdb84 modules: add mkAliasOptionModuleMD
mkAliasOptionModule should not default to mdDoc descriptions because
that can break out-of-tree users of documentation infrastructure. add an
explicitly-MD variant for now, to be removed some time after the MD
transition is complete.
2023-01-05 02:33:13 +01:00
Robert Hensing f61d4d346b
Merge pull request #205190 from NixOS/lib.path.relativeNormalise
lib.path.subpath.{isValid,normalise}: init
2023-01-03 13:46:11 +01:00
Silvan Mosberger 0667ef5dd5 lib.path.subpath.normalise: add property tests 2023-01-03 13:21:06 +01:00
Silvan Mosberger 63dd6d20db lib.path.subpath.normalise: init 2023-01-03 13:21:03 +01:00
Silvan Mosberger 98fbcf1788 lib.path.subpath.isValid: init
The first path library function
2023-01-03 13:20:36 +01:00
Silvan Mosberger ba7ed22f84 lib.path: init README.md document
Adds initial work towards a `lib.path` library

Originally proposed in https://github.com/NixOS/nixpkgs/pull/200718, but has
since gone through some revisions

Co-Authored-By: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2023-01-03 13:19:42 +01:00
Martin Weinelt b38111a665
Merge pull request #208698 from amjoseph-nixpkgs/pr/nss/ilp32 2023-01-03 07:00:45 +01:00
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
Adam Joseph de88969f12 lib/systems: fix uname.processor for powerpc{32,64}, mips64
Cross-compilation of anything downstream of gtk3 requires qemu (due to
gobject-introspection) with --target-list=*-linux-user.  Without this commit,
those qemu builds will fail on a powerpc64le host due to qemu being configured
with --cpu=powerpc64le instead of --cpu=ppc64le.  Unfortunately the build
failure message from qemu in this situation is extremely cryptic.

The root cause turns out not to be the qemu expression, but rather the fact that
on powerpc64le hostPlatform.uname.processor returns the gnu-name (powerpc64le)
for the cpu instead of the linux-name (ppc64le) for the cpu.

uname.processor on mips64el also needs adjustment -- the Linux-name is "mips64"
for both big and little endian (unlike powerpc64, where the Linux-name includes
a "le" suffix):

```
nix@oak:/tmp$ uname -m; lscpu | head -n2
mips64
Architecture:        mips64
Byte Order:          Little Endian
```

uname.processor on powerpc32 has also been adjusted.
2023-01-01 16:20:50 -08:00
YoshiRulz 7fba83890c
lib: Fix mismatched quotes in lib.* doc comments
caused problems for automated rich text generation such as
https://teu5us.github.io/nix-lib.html#customisation-functions
2023-01-02 08:25:17 +10: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
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