diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/attrsets.nix | 3 | ||||
-rw-r--r-- | lib/default.nix | 4 | ||||
-rw-r--r-- | lib/deprecated.nix | 2 | ||||
-rw-r--r-- | lib/kernel.nix | 10 | ||||
-rw-r--r-- | lib/licenses.nix | 26 | ||||
-rw-r--r-- | lib/lists.nix | 4 | ||||
-rw-r--r-- | lib/minver.nix | 2 | ||||
-rw-r--r-- | lib/tests/maintainers.nix | 11 | ||||
-rw-r--r-- | lib/tests/release.nix | 15 |
9 files changed, 57 insertions, 20 deletions
diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 7d84c25de77a1..d91d7a0cd47e6 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -253,7 +253,7 @@ rec { /* Like `mapAttrsRecursive', but it takes an additional predicate function that tells it whether to recursive into an attribute set. If it returns false, `mapAttrsRecursiveCond' does not - recurse, but does apply the map function. It is returns true, it + recurse, but does apply the map function. If it returns true, it does recurse, and does not apply the map function. Type: @@ -469,6 +469,7 @@ rec { getBin = getOutput "bin"; getLib = getOutput "lib"; getDev = getOutput "dev"; + getMan = getOutput "man"; /* Pick the outputs of packages to place in buildInputs */ chooseDevOutputs = drvs: builtins.map getDev drvs; diff --git a/lib/default.nix b/lib/default.nix index d00c4abec0a96..7387e9d9f1ffe 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -77,7 +77,7 @@ let genAttrs isDerivation toDerivation optionalAttrs zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil recursiveUpdate matchAttrs overrideExisting getOutput getBin - getLib getDev chooseDevOutputs zipWithNames zip + getLib getDev getMan chooseDevOutputs zipWithNames zip recurseIntoAttrs dontRecurseIntoAttrs; inherit (lists) singleton forEach foldr fold foldl foldl' imap0 imap1 concatMap flatten remove findSingle findFirst any all count @@ -141,7 +141,7 @@ let mergeAttrsWithFunc mergeAttrsConcatenateValues mergeAttrsNoOverride mergeAttrByFunc mergeAttrsByFuncDefaults mergeAttrsByFuncDefaultsClean mergeAttrBy - fakeSri fakeSha256 fakeSha512 + fakeHash fakeSha256 fakeSha512 nixType imap; inherit (versions) splitVersion; diff --git a/lib/deprecated.nix b/lib/deprecated.nix index 8c4fe9c390c6f..be0ef904c66de 100644 --- a/lib/deprecated.nix +++ b/lib/deprecated.nix @@ -272,7 +272,7 @@ rec { imap = imap1; # Fake hashes. Can be used as hash placeholders, when computing hash ahead isn't trivial - fakeSri = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; + fakeHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; fakeSha256 = "0000000000000000000000000000000000000000000000000000000000000000"; fakeSha512 = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; } diff --git a/lib/kernel.nix b/lib/kernel.nix index 2ce19f8cb68c0..ffcbc268b76cf 100644 --- a/lib/kernel.nix +++ b/lib/kernel.nix @@ -8,13 +8,13 @@ with lib; option = x: x // { optional = true; }; - yes = { tristate = "y"; }; - no = { tristate = "n"; }; - module = { tristate = "m"; }; - freeform = x: { freeform = x; }; + yes = { tristate = "y"; optional = false; }; + no = { tristate = "n"; optional = false; }; + module = { tristate = "m"; optional = false; }; + freeform = x: { freeform = x; optional = false; }; /* - Common patterns/legacy used in common-config/hardened-config.nix + Common patterns/legacy used in common-config/hardened/config.nix */ whenHelpers = version: { whenAtLeast = ver: mkIf (versionAtLeast version ver); diff --git a/lib/licenses.nix b/lib/licenses.nix index 4c07797b16c28..ed4d80fffac65 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -95,6 +95,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) { fullName = ''BSD 2-clause "Simplified" License''; }; + bsd2Patent = spdx { + spdxId = "BSD-2-Clause-Patent"; + fullName = ''BSD-2-Clause Plus Patent License''; + }; + bsd3 = spdx { spdxId = "BSD-3-Clause"; fullName = ''BSD 3-clause "New" or "Revised" License''; @@ -276,6 +281,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) { fullName = "European Union Public License 1.2"; }; + fdl11 = spdx { + spdxId = "GFDL-1.1-only"; + fullName = "GNU Free Documentation License v1.1 only"; + }; + fdl12 = spdx { spdxId = "GFDL-1.2-only"; fullName = "GNU Free Documentation License v1.2 only"; @@ -457,6 +467,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) { fullName = "GNU Lesser General Public License v3.0 or later"; }; + lgpllr = spdx { + spdxId = "LGPLLR"; + fullName = "Lesser General Public License For Linguistic Resources"; + }; + libpng = spdx { spdxId = "Libpng"; fullName = "libpng License"; @@ -477,6 +492,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) { url = "https://opensource.franz.com/preamble.html"; }; + llvm-exception = spdx { + spdxId = "LLVM-exception"; + fullName = "LLVM Exception"; # LLVM exceptions to the Apache 2.0 License + }; + lppl12 = spdx { spdxId = "LPPL-1.2"; fullName = "LaTeX Project Public License v1.2"; @@ -540,6 +560,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) { fullName = "Non-Profit Open Software License 3.0"; }; + obsidian = { + fullName = "Obsidian End User Agreement"; + url = "https://obsidian.md/eula"; + free = false; + }; + ocamlpro_nc = { fullName = "OCamlPro Non Commercial license version 1"; url = "https://alt-ergo.ocamlpro.com/http/alt-ergo-2.2.0/OCamlPro-Non-Commercial-License.pdf"; diff --git a/lib/lists.nix b/lib/lists.nix index f9f30412770a2..f424946c72cd3 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -73,8 +73,8 @@ rec { lconcat [ "a" "b" "c" ] => "zabc" # different types - lstrange = foldl (str: int: str + toString (int + 1)) "" - strange [ 1 2 3 4 ] + lstrange = foldl (str: int: str + toString (int + 1)) "a" + lstrange [ 1 2 3 4 ] => "a2345" */ foldl = op: nul: list: diff --git a/lib/minver.nix b/lib/minver.nix index fee6b65a2447e..86391bcd69e04 100644 --- a/lib/minver.nix +++ b/lib/minver.nix @@ -1,2 +1,2 @@ # Expose the minimum required version for evaluating Nixpkgs -"2.0" +"2.2" diff --git a/lib/tests/maintainers.nix b/lib/tests/maintainers.nix index 60d296eecae6a..d3ed398c80a17 100644 --- a/lib/tests/maintainers.nix +++ b/lib/tests/maintainers.nix @@ -1,10 +1,11 @@ -# to run these tests: -# nix-build nixpkgs/lib/tests/maintainers.nix -# If nothing is output, all tests passed -{ pkgs ? import ../.. {} }: +# to run these tests (and the others) +# nix-build nixpkgs/lib/tests/release.nix +{ # The pkgs used for dependencies for the testing itself + pkgs +, lib +}: let - inherit (pkgs) lib; inherit (lib) types; maintainerModule = { config, ... }: { diff --git a/lib/tests/release.nix b/lib/tests/release.nix index ec0f9c32d3f76..eebee1b49bc84 100644 --- a/lib/tests/release.nix +++ b/lib/tests/release.nix @@ -1,8 +1,17 @@ -{ pkgs ? import ../.. {} }: +{ # The pkgs used for dependencies for the testing itself + # Don't test properties of pkgs.lib, but rather the lib in the parent directory + pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; } +}: pkgs.runCommandNoCC "nixpkgs-lib-tests" { - buildInputs = [ pkgs.nix (import ./check-eval.nix) (import ./maintainers.nix { inherit pkgs; }) ]; - NIX_PATH = "nixpkgs=${toString pkgs.path}"; + buildInputs = [ + pkgs.nix + (import ./check-eval.nix) + (import ./maintainers.nix { + inherit pkgs; + lib = import ../.; + }) + ]; } '' datadir="${pkgs.nix}/share" export TEST_ROOT=$(pwd)/test-tmp |