about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorDanylo Hlynskyi <abcz2.uprola@gmail.com>2019-08-05 14:09:28 +0300
committerGitHub <noreply@github.com>2019-08-05 14:09:28 +0300
commit7585496effbf7fe7815265c2211e8745a90d3136 (patch)
tree38eda227ff9b4ef2c467388a6a399d4daf929b06 /lib
parentd0413360d3a6c51dc56d4ce0ab07ad4678a83ada (diff)
parent4e795680bef5fb8740442451496f890c301d8592 (diff)
downloadnixlib-7585496effbf7fe7815265c2211e8745a90d3136.tar
nixlib-7585496effbf7fe7815265c2211e8745a90d3136.tar.gz
nixlib-7585496effbf7fe7815265c2211e8745a90d3136.tar.bz2
nixlib-7585496effbf7fe7815265c2211e8745a90d3136.tar.lz
nixlib-7585496effbf7fe7815265c2211e8745a90d3136.tar.xz
nixlib-7585496effbf7fe7815265c2211e8745a90d3136.tar.zst
nixlib-7585496effbf7fe7815265c2211e8745a90d3136.zip
Merge branch 'master' into flip-map-foreach
Diffstat (limited to 'lib')
-rw-r--r--lib/sources.nix16
-rw-r--r--lib/systems/doubles.nix2
-rw-r--r--lib/systems/examples.nix12
-rw-r--r--lib/types.nix10
4 files changed, 28 insertions, 12 deletions
diff --git a/lib/sources.nix b/lib/sources.nix
index 0ffadea8f1bc..c4680087b245 100644
--- a/lib/sources.nix
+++ b/lib/sources.nix
@@ -53,12 +53,16 @@ rec {
   # Filter sources by a list of regular expressions.
   #
   # E.g. `src = sourceByRegex ./my-subproject [".*\.py$" "^database.sql$"]`
-  sourceByRegex = src: regexes: cleanSourceWith {
-    filter = (path: type:
-      let relPath = lib.removePrefix (toString src + "/") (toString path);
-      in lib.any (re: builtins.match re relPath != null) regexes);
-    inherit src;
-  };
+  sourceByRegex = src: regexes:
+    let
+      isFiltered = src ? _isLibCleanSourceWith;
+      origSrc = if isFiltered then src.origSrc else src;
+    in lib.cleanSourceWith {
+      filter = (path: type:
+        let relPath = lib.removePrefix (toString origSrc + "/") (toString path);
+        in lib.any (re: builtins.match re relPath != null) regexes);
+      inherit src;
+    };
 
   # Get all files ending with the specified suffices from the given
   # directory or its descendants.  E.g. `sourceFilesBySuffices ./dir
diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix
index f096a0b17fc6..823f6a915d6e 100644
--- a/lib/systems/doubles.nix
+++ b/lib/systems/doubles.nix
@@ -26,7 +26,7 @@ let
 
     "riscv32-linux" "riscv64-linux"
 
-    "aarch64-none" "avr-none" "arm-none" "i686-none" "x86_64-none" "powerpc-none" "msp430-none"
+    "aarch64-none" "avr-none" "arm-none" "i686-none" "x86_64-none" "powerpc-none" "msp430-none" "riscv64-none" "riscv32-none"
   ];
 
   allParsed = map parse.mkSystemFromString all;
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index d17af9fcc148..aa55438de082 100644
--- a/lib/systems/examples.nix
+++ b/lib/systems/examples.nix
@@ -97,6 +97,18 @@ rec {
   riscv64 = riscv "64";
   riscv32 = riscv "32";
 
+  riscv64-embedded = {
+    config = "riscv64-none-elf";
+    libc = "newlib";
+    platform = platforms.riscv-multiplatform "64";
+  };
+
+  riscv32-embedded = {
+    config = "riscv32-none-elf";
+    libc = "newlib";
+    platform = platforms.riscv-multiplatform "32";
+  };
+
   msp430 = {
     config = "msp430-elf";
     libc = "newlib";
diff --git a/lib/types.nix b/lib/types.nix
index b225119299da..e22bcd326c86 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -111,7 +111,7 @@ rec {
         name = "int";
         description = "signed integer";
         check = isInt;
-        merge = mergeOneOption;
+        merge = mergeEqualOption;
       };
 
     # Specialized subdomains of int
@@ -176,14 +176,14 @@ rec {
         name = "float";
         description = "floating point number";
         check = isFloat;
-        merge = mergeOneOption;
+        merge = mergeEqualOption;
     };
 
     str = mkOptionType {
       name = "str";
       description = "string";
       check = isString;
-      merge = mergeOneOption;
+      merge = mergeEqualOption;
     };
 
     strMatching = pattern: mkOptionType {
@@ -243,7 +243,7 @@ rec {
       name = "path";
       # Hacky: there is no ‘isPath’ primop.
       check = x: builtins.substring 0 1 (toString x) == "/";
-      merge = mergeOneOption;
+      merge = mergeEqualOption;
     };
 
     # drop this in the future:
@@ -415,7 +415,7 @@ rec {
         name = "enum";
         description = "one of ${concatMapStringsSep ", " show values}";
         check = flip elem values;
-        merge = mergeOneOption;
+        merge = mergeEqualOption;
         functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
       };