Commit graph

2726 commits

Author SHA1 Message Date
Robert Hensing 99bc203025 Partially revert "lib/modules: Drop mkStrict and mkFixStrictness"
mkFixStrictness was never properly deprecated and should only be
removed after warning for some time.

This partially reverts commit 8fb9984690.
2021-07-12 07:25:52 +02:00
Niklas Hambüchen 5db6b909cd
strings.nix: Fix overly monomorphic type signature comments
These functions work on lists of anything, not just lists of strings.
2021-07-04 20:52:48 +02:00
Robert Hensing 4c4c00e9f1
Merge pull request #124875 from hercules-ci/lib-sources
lib.sources: docs, tests, refactoring
2021-06-28 14:02:37 +02:00
github-actions[bot] e8122c3628
Merge master into staging-next 2021-06-23 00:09:33 +00:00
Silvan Mosberger b3e9073c48
Merge pull request #125991 from helsinki-systems/drop/mkStrict
lib/modules: Drop mkStrict and mkFixStrictness
2021-06-23 00:48:59 +02:00
Martin Weinelt eef9694ebc
Merge branch 'master' into staging-next 2021-06-22 00:58:31 +02:00
Pavol Rusnak 68889ed61f
treewide: use quotes for url 2021-06-20 16:26:23 +02:00
Zhaofeng Li afe09e41df mesaPlatforms: Welcome riscv64-linux to the family 2021-06-12 20:45:35 -07:00
tomberek 3a745b2c2c
Merge pull request #125942 from musfay/rlottie
rlottie: 0.1 -> 0.2
2021-06-07 01:08:30 -04:00
Janne Heß 8fb9984690
lib/modules: Drop mkStrict and mkFixStrictness
This was deprecated in 2014 and is not used anywhere in the tree.
2021-06-06 20:53:05 +02:00
Alyssa Ross 4d6a0bb966 lib.systems.parsed: add "elf" for some NetBSD archs
In Autoconf, some old NetBSD targets like "i686-unknown-netbsd" are
interpreted as a.out, not elf, and virtually nothing supports it.  We
need to specify e.g. "i686-unknown-netbsdelf" to get the right
behaviour.
2021-06-06 18:52:58 +00:00
Alyssa Ross 5a8372d04e lib.systems.parse.kernels: fix typo in comment 2021-06-06 18:52:58 +00:00
Mustafa Çalışkan 642dce498a
rlottie: 0.1 -> 0.2 2021-06-06 14:15:36 +03:00
Sandro 870dce75e3
Merge pull request #82642 from magnetophon/faustPhysicalModeling 2021-06-06 01:39:04 +02:00
Michael Weiss ed8115ef5b
Merge pull request #124992 from primeos/android-tools
android-tools: init at 31.0.0p1
2021-06-02 21:06:00 +02:00
Michael Weiss c57b309d32
android-tools: init at 31.0.0p1
lowPrio is used to avoid collisions with the simg2img package.
Licensing information is in share/licenses/android-tools/AOSP_LICENSE.
2021-06-02 12:08:01 +02:00
Zhaofeng Li e2aee93caf platforms: Enable ftrace support for RISC-V
Support has landed in mainline for a while.
2021-06-01 19:49:30 -07:00
Zhaofeng Li 805e9ce9ea platforms: Build flat kernel image for RISC-V
Newer bootloaders for RISC-V (i.e., OpenSBI + U-Boot) support
flat and compressed kernel images but not vmlinux. Therefore,
let's build "Image" like what we do with aarch64.

Also copy DTBs while we are at it.
2021-06-01 19:49:30 -07:00
Robert Hensing 4cf56e5640 lib.sources.trace: init 2021-05-29 16:03:55 +02:00
Robert Hensing 970273023a lib.sources.sourceFilesBySuffices: Improve doc 2021-05-29 16:03:54 +02:00
Robert Hensing d14be76615 lib/tests/sources.sh: init 2021-05-29 14:32:56 +02:00
Robert Hensing dfd2b1bd90 lib/sources: Internal representation for cleanSourceWith 2021-05-29 14:32:56 +02:00
Robert Hensing 285632320d lib.types.enum: Improve description for lengths 0 and 1 2021-05-25 10:53:04 +02:00
Anderson Torres 41d76a33eb
Merge pull request #119967 from xoe-labs/da/add-lib-flake
init: lib/flake
2021-05-24 02:06:19 -03:00
Jonathan Ringer 11a9ac00fc
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
 pkgs/tools/networking/xh/default.nix
2021-05-22 18:19:10 -07:00
Jonathan Ringer ff1ded3e20 21.11 is Porcupine! 2021-05-22 18:14:06 -07:00
Andrew Childs 755d980440 darwin: use "11.0" as sdk and minimum version on aarch64-darwin 2021-05-17 00:27:03 +09:00
Andrew Childs 23cae56ca7 lib/systems/platforms: add Apple M1 2021-05-17 00:27:03 +09:00
Moritz Angermann 3a3df3146e Add crossPkgs.aarch64-darwin 2021-05-17 00:27:02 +09:00
Matthew Bauer a6753d0c42 lib/systems: add aarch64-darwin to mesaPlatforms 2021-05-17 00:27:02 +09:00
github-actions[bot] 78ae7ac75e
Merge staging-next into staging 2021-05-15 06:22:25 +00:00
John Ericson 18c38f8aee treewide: All the linker to be chosen independently
This will begin the process of breaking up the `useLLVM` monolith. That
is good in general, but I hope will be good for NetBSD and Darwin in
particular.

Co-authored-by: sterni <sternenseemann@systemli.org>
2021-05-14 21:29:51 +00:00
Ben Siraphob f986333023 lib/systems/parse: make isCompatible description clearer and more useful
Stating that CPUs and the isCompatible relation forms a category (or
preorder) is correct but overtly technical.  We can state it more
clearly for readers unfamiliar with mathematics while retaining some
keywords to be useful to technical readers.
2021-05-14 13:23:28 -07:00
s1341 1e1d29c2af treewide: Support aarch64-android using minimal prebuilt components
This PR adds a new aarch64 android toolchain, which leverages the
existing crossSystem infrastructure and LLVM builders to generate a
working toolchain with minimal prebuilt components.

The only thing that is prebuilt is the bionic libc. This is because it
is practically impossible to compile bionic outside of an AOSP tree. I
tried and failed, braver souls may prevail. For now I just grab the
relevant binaries from https://android.googlesource.com/.

I also grab the msm kernel sources from there to generate headers. I've
included a minor patch to the existing kernel-headers derivation in
order to expose an internal function.

Everything else, from binutils up, is using stock code. Many thanks to
@Ericson2314 for his help on this, and for building such a powerful
system in the first place!

One motivation for this is to be able to build a toolchain which will
work on an aarch64 linux machine. To my knowledge, there is no existing
toolchain for an aarch64-linux builder and an aarch64-android target.
2021-05-11 15:39:08 +00:00
Erlend Pedersen 3452a739d1
nixpkgs-manual: lib.attrsets.mapAttrsToList returns a list (#122179) 2021-05-08 13:55:11 +02:00
Silvan Mosberger fb1969806f
Merge pull request #117888 from kvtb/patch-3
types.nix: fix outdated comment
2021-05-08 05:46:10 +02:00
Silvan Mosberger 08d94fd2b0
Merge pull request #114374 from oxalica/lib/platform-support-check
lib.meta: introduce `availableOn` to check package availability on given platform
2021-05-08 03:54:36 +02:00
Silvan Mosberger 527861959b
Merge pull request #119406 from sternenseemann/toDerivation-list
lib/attrsets: make toDerivation x always work when isStorePath x
2021-05-07 02:09:05 +02:00
Robert Hensing 0633b6aa74
Merge pull request #121870 from Pacman99/pass-specialargs
lib/modules: pass specialArgs to modules
2021-05-07 01:54:48 +02:00
sternenseemann f39a5c4e50 lib/strings: forbid lists in isStorePath
When a list is passed to isStorePath this is most likely a mistake and
it is therefore better to just return false. There is one case where
this theoretically makes sense (if a list contains a single element for
which isStorePath elem), but since that case is also probably seldomly
intentional, it may save someone from debbuging unclear evaluation
errors.
2021-05-07 01:22:30 +02:00
sternenseemann 326d0970e0 lib/strings: fix example for isStorePath
Since it checks if dirOf x is the nix store dir, a trailing slash will
break this check and make it return false.
2021-05-07 01:22:30 +02:00
Pacman99 c949e60220 lib/modules: pass specialArgs as a module argument 2021-05-06 16:04:08 -07:00
John Ericson 470640e7fe treewide: Do a number of no-op cleanups for cross and darwin
I am taking the non-invasive parts of #110914 to hopefully help out with #111988.

In particular:

 - Use `lib.makeScopeWithSplicing` to make the `darwin` package set have
   a proper `callPackage`.

 - Adjust Darwin `stdenv`'s overlays keeping things from the previous
   stage to not stick around too much.

 - Expose `binutilsNoLibc` / `darwin.binutilsNoLibc` to hopefully get us
   closer to a unified LLVM and GCC bootstrap.
2021-05-06 11:17:26 -04:00
Silvan Mosberger 98c77a0b2d lib/modules: Small optimization 2021-05-06 04:59:27 +02:00
Silvan Mosberger f445acbe0a
Merge pull request #114955 from berbiche/fix/modules-imports-list
lib/modules: provide a better error message when "imports" contains a list
2021-05-05 23:20:39 +02:00
Nicolas Berbiche 810c9c6a0e
lib/modules: provide error message when imports contains a list 2021-05-05 14:15:04 -04:00
Robert Hensing a36e6760e9 Revert "lib/modules: Issue type deprecation warnings recursively"
This reverts commit 4b54aedee5.
2021-05-05 18:53:34 +02:00
Robert Hensing e7412dde1f Revert "lib/tests: Add type deprecation tests"
This reverts commit 8b957e3b30.
2021-05-05 18:53:28 +02:00
Silvan Mosberger 8b957e3b30 lib/tests: Add type deprecation tests 2021-05-03 22:16:06 +02:00
Silvan Mosberger 4b54aedee5 lib/modules: Issue type deprecation warnings recursively
Previously, an option of type

  attrsOf string

wouldn't throw a deprecation warning, even though the string type is
deprecated. This was because the deprecation warning trigger only looked
at the type of the option itself, not any of its subtypes.

This commit fixes this, causing each of the types deprecationMessages to
trigger for the option. This relies on the subtypes mkOptionType
attribute introduced in 26607a5a2e06653fec453c83d063cdfc4b59185f
2021-05-03 22:16:02 +02:00
Silvan Mosberger ce5e3113c3 lib/tests: Make sure the submodule type description can be evaluated
In 2d45a62899, the submodule type
description was amended with the freeformType description. This causes
all the modules passed to the submodule to be evaluated once on their
own, without any extra definitions from the config section. This means
that the specified modules need to be valid on their own, without any
undeclared options.

This commit adds a test that evaluates a submodules option description,
which would trigger the above problem for one of the tests, if it were
not fixed by this commit as well.

This is done because the next commit makes option evaluation a bit more
strict, which would also trigger this test failure, even though it's not
related to the change at all.
2021-05-03 22:15:33 +02:00
Silvan Mosberger 68955fe612 lib/types: Introduce mkOptionType occurringTypes argument
This will be used to issue deprecation warnings recursively in the next
commit

In addition, this allows easily getting nested types of other options, which
is useful when you want to create an option that aliases a part of
another one.
2021-05-03 22:15:30 +02:00
Silvan Mosberger 680a901ae1
Merge pull request #120774 from sternenseemann/shellpackage-fix-check
lib/types: only accept derivations for shellPackage
2021-05-03 16:42:08 +02:00
Lennart Spitzner 8c70a1a989
lib: fix documented type of fixedWidthString (#121396) 2021-05-01 17:29:00 +02:00
Alyssa Ross a8afbb45c1 treewide: use lib.warnIf where appropriate 2021-04-28 21:44:21 +00:00
Alyssa Ross 81e1e68eaf lib.trivial.warnIf: init
It's a common pattern in Nixpkgs to want to emit a warning in certain
cases, but not actually change behaviours.

This is often expressed as either
	if cond then lib.warn "Don't do that thing" x else x
Or
	(if cond then lib.warn "Don't do that thing" else lib.id) x

Neither of which really expresses the intent here, because it looks
like 'x' is being chosen conditionally.

To make this clearer, I introduce a "warnIf" function, which makes it
clear that the only thing being affected by the condition is whether
the warning is generated, not the value being returned.
2021-04-28 21:44:21 +00:00
David Arnold 2cd41fb432
init: lib/flake
A subflake that can be indidividually accessed without also providing
an interface to the whole of nixpkgs.

Usage:
inputs.nixpkgs-lib.url = "github:NixOS/nixpkgs?dir=lib"
2021-04-28 14:21:27 -05:00
sternenseemann 8a83d611f5 lib/types: only accept derivations for shellPackage
Since shellPackage actually requires the value to be an attribute set
(i. e. an derivation in this case), we cannot re-use the package.check
type checker since it also allows strings or things that are coercible
to strings as long as they look like store paths.
2021-04-26 20:43:43 +02:00
Jan Tojnar 0f1c4558d3
Merge branch 'master' into staging-next
Choose binwalk 2.3.1, 27 is legacy version for Python 2.
2021-04-25 02:50:48 +02:00
github-actions[bot] 6e7c70d02d
Merge master into staging-next 2021-04-24 00:16:17 +00:00
Alyssa Ross 532493b508
lib.systems.doubles.netbsd: expand
These are all the architectures supported by Nixpkgs on other
platforms, that are also supported by NetBSD.  (So I haven't added
any architectures that are new to Nixpkgs here, even though NetBSD
supports some that we don't have.)
2021-04-23 22:23:25 +00:00
Alyssa Ross cf5d480a06
lib.systems.doubles.all: reorganize
The previous mess was partially grouped by OS, and partially grouped
by architecture, which made it very difficult to know where to add new
entries.

I've chosen to group by OS entirely, because OSes are likely to
maintain exhaustive lists of supported architectures, but it's far
less likely we'd be able to find exhaustive lists of supported OSes
for every architecture.
2021-04-23 13:19:00 +00:00
github-actions[bot] 9c190d28df
Merge master into staging-next 2021-04-15 12:06:13 +00:00
Alyssa Ross 9767460d00 lib.systems.examples.amd64-netbsd: add warning
Otherwise, nobody will know it's deprecated!
2021-04-15 10:45:04 +00:00
github-actions[bot] 8b35f0c117
Merge master into staging-next 2021-04-15 06:05:40 +00:00
John Ericson a2650e1257 lib: Adjust NetBSD example systems
Deprecate the odd one so no breaking change.
2021-04-15 04:38:17 +00:00
Luke Granger-Brown 08b22e605b Merge remote-tracking branch 'upstream/staging-next' into down-integrate-staging 2021-04-12 18:49:01 +00:00
John Ericson 82ca81cd62
Merge pull request #111988 from thefloweringash/darwin-platform-versions
Darwin platform versions
2021-04-12 11:40:16 -04:00
Sandro 9f198c1423
Merge pull request #116495 from r-burns/ppc64
lib/systems: remove powerpc64 elfv1 support
2021-04-12 16:44:14 +02:00
Andrew Childs d0418480f1 lib.systems: add darwinPlatform where necessary 2021-04-11 09:47:10 +09:00
Andrew Childs 6c4ce7960e bintools-wrapper, cc-wrapper: parameterize darwin min version variable
These variables are the ones that the standard toolchain uses, so we
should use those and not always use MACOSX_DEPLOYMENT_TARGET.

See 236a426c12/cctools/ld64/src/ld/PlatformSupport.cpp (L54-L55)
2021-04-11 09:47:10 +09:00
ajs124 ff2e6fcf37 lib.licenses: add bsdOriginalUC (BSD 4-Clause University of California-Specific) 2021-04-09 19:42:27 +00:00
Milan Pässler 5f7aa7a973 systems: add appropriate rustc.config for android
Rust doesn't like the `-unknown` vendor component in the target triple.
2021-04-09 12:09:06 +02:00
Alyssa Ross fae6b04160
lib.trivial: fix typo "nixpks" -> "nixpkgs" 2021-04-05 10:13:33 +00:00
oxalica 354d262db8
lib.meta: introduce availableOn 2021-04-02 19:20:23 +08:00
Emery Hemingway 1cd48efa96 lib/generators: add toDhall 2021-04-01 14:29:57 +02:00
kvtb 1c0d31d042
types.nix: types.ints.s32 and types.ints.u32 do work 2021-03-30 15:03:53 +00:00
kvtb 3131cdf05b
types.nix: fix outdated comment
Nix's `int` is always 64-bit
2021-03-28 14:04:39 +00:00
Léo Gaspard 144a997c8e
lib: fix commitIdFromGitRepo (#117752)
When in the presence of worktrees, it happens that /commondir has a
trailing slash.

In these circumstances, it can lead to `lib.pathType` being passed paths
like `/foo/bar/.git/`, which in turn lead to
`error: attribute '.git' missing`.

With this change, we now make sure send properly-formatted paths to all
other functions.

This, in particular, fixes running NixOS tests on worktrees created by
libgit2 on my machine. (Worktrees created by git itself appear to not
hit the issue.)
2021-03-27 21:16:31 +01:00
Andrew Childs 44f09ccabf darwin: move deployment target and sdk version to platform config 2021-03-26 15:10:22 +09:00
Silvan Mosberger 3d19f1d574
Merge pull request #115919 from Ma27/module-error-improvement
lib/modules: better error message if an attr-set of options is expected
2021-03-26 00:27:35 +01:00
John Ericson c82066e585
Merge pull request #113212 from lopsided98/kernel-arm-fix
lib/systems/platforms: remove TI_CPTS override
2021-03-21 13:22:53 -04:00
Jan Tojnar 2445e9a681
Merge branch 'master' into staging-next 2021-03-18 19:24:39 +01:00
Aaron Andersen 7f70d66a53 licenses.odbl: init at 1.0 2021-03-17 21:52:19 -04:00
Ryan Burns 8ea1660b9e lib/systems: remove powerpc64 elfv1 support
I was specifying the ELF ABI using -elfv1 and -elfv2 target config
suffixes, which are nonstandard and no longer work with gnu-config.
2021-03-15 19:27:41 -07:00
Maximilian Bosch e878fc4aac
lib/modules: better error message if an attr-set of options is expected
I recently wrote some Nix code where I wrongly set a value to an option
which wasn't an actual option, but an attr-set of options. The mistake I
made can be demonstrated with an expression like this:

    {
      foo = { lib, pkgs, config, ... }: with lib; {
        options.foo.bar.baz = mkOption {
          type = types.str;
        };
        config.foo.bar = 23;
      };
    }

While it wasn't too hard to find the cause of the mistake for me, it was
necessary to have some practice in reading stack traces from the module
system since the eval-error I got was not very helpful:

    error: --- TypeError --------------------------------------------------------- nix-build
    at: (323:25) in file: /nix/store/3nm31brdz95pj8gch5gms6xwqh0xx55c-source/lib/modules.nix

       322|         foldl' (acc: module:
       323|                 acc // (mapAttrs (n: v:
          |                         ^
       324|                                    (acc.${n} or []) ++ f module v

    value is an integer while a set was expected
    (use '--show-trace' to show detailed location information)

I figured that such an error can be fairly confusing for someone who's
new to NixOS, so I decided to catch this case in th `byName` function in
`lib/modules.nix` by checking if the value to map through is an actual
attr-set. If not, a different error will be thrown.
2021-03-11 14:55:56 +01:00
Andrew Childs 1303257d88 lib/systems: add darwinArch 2021-03-02 17:13:15 +09:00
sternenseemann 7f7d5bcd90 lib/licenses: fix regression removing shortName for some licenses
Usually we ensure using the mapAttrs call wrapping the license set that
every license has an associated shortName. A change related to legacy
aliases most likely introduced the removal of the shortName attribute
for all the legacy license names by splitting the set into two sets
connected by a record update operator -- leading to mapAttrs only
affecting the first set.

Since it used to be a valid assumption to have that every license had a
shortName attribute, we reintroduce this attribute for the legacy
aliases as well.
2021-02-25 23:01:09 +01:00
Ben Wolsieffer 7b573e8051 lib/systems/platforms: remove TI_CPTS override
Forcing the module to be builtin breaks 5.10, which wants to compile it as a
module (probably due to dependencies). There doesn't seem to be a need to have
it builtin anymore, so we can just remove the override.
2021-02-15 11:23:17 -05:00
Ben Wolsieffer 1e1588898b lib/systems/platforms: note that RPi 3 fixes aren't needed for kernel >=4.17 2021-02-15 11:23:17 -05:00
Michael Raskin 5a1a7a359f
Merge pull request #112885 from alyssais/wiktionary
dictdDBs.wiktionary: 20161001 -> 20210201; refactor
2021-02-12 19:12:45 +00:00
Alyssa Ross 56de41bc80
lib.licenses.fdl11Plus: init 2021-02-11 15:08:59 +00:00
Philipp Adolf 408ae0b13a lib: fix typo in platforms.nix
In 9c213398b3 kernelPreferBuiltin was
moved/renamed to linux-kernel.preferBuiltin. However, for
armv7l-hf-multiplatform the new option was written with an uppercase P,
which made the kernel build process ignore it.
2021-02-11 08:58:04 +01:00
Bernardo Meurer 6ca28ab28e
lib: remove mention of flashplayer in docs 2021-02-08 09:38:41 -08:00
Fabian Affolter f5a0053546 lib.licenses: add bsd1 (BSD 1-Clause License) 2021-02-02 14:37:19 +01:00
sternenseemann 06d3b28987 Revert "lib/generators: fix toPretty throwing on (partially applied) builtins"
This reverts commit d9a7d03da8.

Reason for this is that it actually doesn't migitate the issue on nix
stable for another reason: builtins.tryEval doesn't prevent the error
generated by builtins.functionArgs from halting evaluation:

> builtins.tryEval (builtins.functionArgs builtins.functionArgs)
error: 'functionArgs' requires a function, at (string):1:19

Thus it seems that there is no workaround to make
lib.generators.toPretty work with nix stable and primops since there is
no way to distinguish between primops and lambdas in nix.
2021-02-01 16:27:38 +01:00
Silvan Mosberger 59b45d66b2
Merge pull request #111469 from sternenseemann/topretty-fix-currying
lib/generators: fix toPretty throwing on (partially applied) builtins
2021-01-31 21:20:17 +01:00
Fritz Otlinghaus e0215b3175
lib/types: add description for functionTo 2021-01-31 15:59:13 +01:00
sternenseemann d9a7d03da8 lib/generators: fix toPretty throwing on (partially applied) builtins
An high level example case of this problem occuring can be found below:

nix-repl> lib.generators.toPretty {} (lib.concatStringsSep "\n")
error: 'functionArgs' requires a function, at /home/lukas/src/nix/nixpkgs/lib/trivial.nix:334:42

However this does not happen on other partially applied functions:

nix-repl> lib.generators.toPretty {} (lib.concatMapStringsSep "\n")
"<function>"

The issue, as it turns out is that while builtins are functions,
builtins.functionArgs throws if is passed a builtin or a partially
applied builtin:

nix-repl> lib.generators.toPretty {} builtins.toString
error: 'functionArgs' requires a function, at /home/lukas/src/nix/nixpkgs/lib/trivial.nix:334:42

nix-repl> lib.generators.toPretty {} (builtins.foldl' (a: b: a + b))
error: 'functionArgs' requires a function, at /home/lukas/src/nix/nixpkgs/lib/trivial.nix:334:42

I'm pretty sure this qualifies as a nix bug and should be filed
accordingly, but we can work around it in lib.generators.toPretty by
using tryEval and falling back to {} which functionArgs _should_ return
for builtins.

The nix behavior is inconsistent to say the least:

nix-repl> builtins.functionArgs builtins.functionArgs
error: 'functionArgs' requires a function, at (string):1:1

nix-repl> builtins.typeOf builtins.functionArgs
"lambda"

builtins.functionArgs (a: 1 + a)
{ }

nix-repl> builtins.typeOf (a: 1 + a)
"lambda"
2021-01-31 15:35:17 +01:00
John Ericson 5fc5e83808
Merge pull request #111345 from r-burns/ppc64-big-endian
Enable PPC64 (big-endian)
2021-01-30 16:26:06 -05:00