about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/attrsets.nix2
-rw-r--r--lib/default.nix27
-rw-r--r--lib/licenses.nix20
-rw-r--r--lib/systems/default.nix2
-rw-r--r--lib/systems/examples.nix6
-rw-r--r--lib/systems/flake-systems.nix4
-rw-r--r--lib/systems/platforms.nix4
-rw-r--r--lib/tests/release.nix4
-rw-r--r--lib/trivial.nix62
9 files changed, 102 insertions, 29 deletions
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 83f8d0f34186e..c0ac6eeb41bcf 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -11,7 +11,7 @@ let
 in
 
 rec {
-  inherit (builtins) attrNames listToAttrs hasAttr isAttrs getAttr removeAttrs;
+  inherit (builtins) attrNames listToAttrs hasAttr isAttrs getAttr removeAttrs intersectAttrs;
 
 
   /**
diff --git a/lib/default.nix b/lib/default.nix
index d5d47defb8e64..9c6f886c9ee46 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -64,22 +64,21 @@ let
     # linux kernel configuration
     kernel = callLibs ./kernel.nix;
 
-    inherit (builtins) add addErrorContext attrNames concatLists
-      deepSeq elem elemAt filter genericClosure genList getAttr
-      hasAttr head isAttrs isBool isInt isList isPath isString length
-      lessThan listToAttrs pathExists readFile replaceStrings seq
-      stringLength sub substring tail trace;
+    # TODO: For consistency, all builtins should also be available from a sub-library;
+    # these are the only ones that are currently not
+    inherit (builtins) addErrorContext isPath trace;
     inherit (self.trivial) id const pipe concat or and xor bitAnd bitOr bitXor
       bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
       importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum
       info showWarnings nixpkgsVersion version isInOldestRelease
-      mod compare splitByAndCompare
+      mod compare splitByAndCompare seq deepSeq lessThan add sub
       functionArgs setFunctionArgs isFunction toFunction mirrorFunctionArgs
-      toHexString toBaseDigits inPureEvalMode;
+      toHexString toBaseDigits inPureEvalMode isBool isInt pathExists
+      genericClosure readFile;
     inherit (self.fixedPoints) fix fix' converge extends composeExtensions
       composeManyExtensions makeExtensible makeExtensibleWithCustomName;
     inherit (self.attrsets) attrByPath hasAttrByPath setAttrByPath
-      getAttrFromPath attrVals attrValues getAttrs catAttrs filterAttrs
+      getAttrFromPath attrVals attrNames attrValues getAttrs catAttrs filterAttrs
       filterAttrsRecursive foldlAttrs foldAttrs collect nameValuePair mapAttrs
       mapAttrs' mapAttrsToList attrsToList concatMapAttrs mapAttrsRecursive
       mapAttrsRecursiveCond genAttrs isDerivation toDerivation optionalAttrs
@@ -87,14 +86,16 @@ let
       recursiveUpdate matchAttrs mergeAttrsList overrideExisting showAttrPath getOutput
       getBin getLib getDev getMan chooseDevOutputs zipWithNames zip
       recurseIntoAttrs dontRecurseIntoAttrs cartesianProduct cartesianProductOfSets
-      mapCartesianProduct updateManyAttrsByPath;
-    inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1
-      ifilter0 concatMap flatten remove findSingle findFirst any all count
+      mapCartesianProduct updateManyAttrsByPath listToAttrs hasAttr getAttr isAttrs intersectAttrs removeAttrs;
+    inherit (self.lists) singleton forEach map foldr fold foldl foldl' imap0 imap1
+      filter ifilter0 concatMap flatten remove findSingle findFirst any all count
       optional optionals toList range replicate partition zipListsWith zipLists
       reverseList listDfs toposort sort sortOn naturalSort compareLists take
       drop sublist last init crossLists unique allUnique intersectLists
-      subtractLists mutuallyExclusive groupBy groupBy';
+      subtractLists mutuallyExclusive groupBy groupBy' concatLists genList
+      length head tail elem elemAt isList;
     inherit (self.strings) concatStrings concatMapStrings concatImapStrings
+      stringLength substring isString replaceStrings
       intersperse concatStringsSep concatMapStringsSep
       concatImapStringsSep concatLines makeSearchPath makeSearchPathOutput
       makeLibraryPath makeIncludePath makeBinPath optionalString
@@ -105,7 +106,7 @@ let
       escapeRegex escapeURL escapeXML replaceChars lowerChars
       upperChars toLower toUpper addContextFrom splitString
       removePrefix removeSuffix versionOlder versionAtLeast
-      getName getVersion
+      getName getVersion match split
       cmakeOptionType cmakeBool cmakeFeature
       mesonOption mesonBool mesonEnable
       nameFromURL enableFeature enableFeatureAs withFeature
diff --git a/lib/licenses.nix b/lib/licenses.nix
index 65705f4bb0b45..a608d3ec3f543 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -362,6 +362,12 @@ in mkLicense lset) ({
     fullName = "Creative Commons Attribution Share Alike 4.0";
   };
 
+  cc-sa-10 = {
+    shortName = "CC-SA-1.0";
+    fullName = "Creative Commons Share Alike 1.0";
+    url = "https://creativecommons.org/licenses/sa/1.0";
+  };
+
   cddl = {
     spdxId = "CDDL-1.0";
     fullName = "Common Development and Distribution License 1.0";
@@ -1279,11 +1285,21 @@ in mkLicense lset) ({
     fullName = "xinetd License";
   };
 
+  xskat = {
+    spdxId = "XSkat";
+    fullName = "XSkat License";
+  };
+
   zlib = {
     spdxId = "Zlib";
     fullName = "zlib License";
   };
 
+  zsh = {
+    url = "https://github.com/zsh-users/zsh/blob/master/LICENCE";
+    fulllName = "Zsh License";
+  };
+
   zpl20 = {
     spdxId = "ZPL-2.0";
     fullName = "Zope Public License 2.0";
@@ -1294,10 +1310,6 @@ in mkLicense lset) ({
     fullName = "Zope Public License 2.1";
   };
 
-  xskat = {
-    spdxId = "XSkat";
-    fullName = "XSkat License";
-  };
 } // {
   # TODO: remove legacy aliases
   apsl10 = {
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index d37ff720edce6..0981122388bb1 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -81,7 +81,7 @@ let
         && final.parsed.kernel == platform.parsed.kernel;
       isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details";
       # Derived meta-data
-      useLLVM = final.isFreeBSD;
+      useLLVM = final.isFreeBSD || final.isOpenBSD;
 
       libc =
         /**/ if final.isDarwin              then "libSystem"
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index 79ec4461e4193..6a9427b2d9de7 100644
--- a/lib/systems/examples.nix
+++ b/lib/systems/examples.nix
@@ -59,7 +59,7 @@ rec {
 
   armv7a-android-prebuilt = {
     config = "armv7a-unknown-linux-androideabi";
-    rustc.config = "armv7-linux-androideabi";
+    rust.rustcTarget = "armv7-linux-androideabi";
     sdkVer = "28";
     ndkVer = "24";
     useAndroidPrebuilt = true;
@@ -67,7 +67,7 @@ rec {
 
   aarch64-android-prebuilt = {
     config = "aarch64-unknown-linux-android";
-    rustc.config = "aarch64-linux-android";
+    rust.rustcTarget = "aarch64-linux-android";
     sdkVer = "28";
     ndkVer = "24";
     useAndroidPrebuilt = true;
@@ -207,7 +207,7 @@ rec {
   aarch64-embedded = {
     config = "aarch64-none-elf";
     libc = "newlib";
-    rustc.config = "aarch64-unknown-none";
+    rust.rustcTarget = "aarch64-unknown-none";
   };
 
   aarch64be-embedded = {
diff --git a/lib/systems/flake-systems.nix b/lib/systems/flake-systems.nix
index b1988c6a4fbb0..a68580ff1407b 100644
--- a/lib/systems/flake-systems.nix
+++ b/lib/systems/flake-systems.nix
@@ -16,12 +16,12 @@
   "armv6l-linux"
   "armv7l-linux"
   "i686-linux"
-  "mipsel-linux"
+  # "mipsel-linux" is excluded because it is not bootstrapped
 
   # Other platforms with sufficient support in stdenv which is not formally
   # mandated by their platform tier.
   "aarch64-darwin"
-  "armv5tel-linux"
+  # "armv5tel-linux" is excluded because it is not bootstrapped
   "powerpc64le-linux"
   "riscv64-linux"
 
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix
index d2e8f77bec03e..403ffc028f0be 100644
--- a/lib/systems/platforms.nix
+++ b/lib/systems/platforms.nix
@@ -535,11 +535,9 @@ rec {
       name = "riscv-multiplatform";
       target = "Image";
       autoModules = true;
+      preferBuiltin = true;
       baseConfig = "defconfig";
       DTB = true;
-      extraConfig = ''
-        SERIAL_OF_PLATFORM y
-      '';
     };
   };
 
diff --git a/lib/tests/release.nix b/lib/tests/release.nix
index 1447e88170913..084fbd94d34c2 100644
--- a/lib/tests/release.nix
+++ b/lib/tests/release.nix
@@ -24,7 +24,9 @@ in
       #
       #   https://github.com/NixOS/nixpkgs/issues/272591
       #
-      [(import ../../pkgs/test/release {})]
+      [(import ../../pkgs/test/release {
+        inherit pkgs lib nix;
+      })]
     ;
 
   }
diff --git a/lib/trivial.nix b/lib/trivial.nix
index dee7eca9699a0..20a3ffebbc2bb 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -403,7 +403,7 @@ in {
     On each release the first letter is bumped and a new animal is chosen
     starting with that new letter.
   */
-  codeName = "Vicuña";
+  codeName = "Vicuna";
 
   /**
     Returns the current nixpkgs version suffix as string.
@@ -623,6 +623,37 @@ in {
   /**
     Reads a JSON file.
 
+    # Examples
+    :::{.example}
+    ## `lib.trivial.importJSON` usage example
+
+    example.json
+    ```json
+    {
+      "title": "Example JSON",
+      "hello": {
+        "world": "foo",
+        "bar": {
+          "foobar": true
+        }
+      }
+    }
+    ```
+
+    ```nix
+    importJSON ./example.json
+    => {
+      title = "Example JSON";
+      hello = {
+        world = "foo";
+        bar = {
+          foobar = true;
+        };
+      };
+    }
+    ```
+
+    :::
 
     # Inputs
 
@@ -642,6 +673,35 @@ in {
   /**
     Reads a TOML file.
 
+    # Examples
+    :::{.example}
+    ## `lib.trivial.importTOML` usage example
+
+    example.toml
+    ```toml
+    title = "TOML Example"
+
+    [hello]
+    world = "foo"
+
+    [hello.bar]
+    foobar = true
+    ```
+
+    ```nix
+    importTOML ./example.toml
+    => {
+      title = "TOML Example";
+      hello = {
+        world = "foo";
+        bar = {
+          foobar = true;
+        };
+      };
+    }
+    ```
+
+    :::
 
     # Inputs