summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-11 14:33:12 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-11 14:36:08 -0400
commitee4b56edd364922c6a20a8d7b21a5a72497b4bc2 (patch)
tree42bd2a09efe21aa446e411201d4974d39f8a8a4f /lib
parent73833ee4465369c9eead8e00ce699053e010de2f (diff)
parent62ee7b7b4713c90048ec7063ca4f4cd7677eeb53 (diff)
downloadnixlib-ee4b56edd364922c6a20a8d7b21a5a72497b4bc2.tar
nixlib-ee4b56edd364922c6a20a8d7b21a5a72497b4bc2.tar.gz
nixlib-ee4b56edd364922c6a20a8d7b21a5a72497b4bc2.tar.bz2
nixlib-ee4b56edd364922c6a20a8d7b21a5a72497b4bc2.tar.lz
nixlib-ee4b56edd364922c6a20a8d7b21a5a72497b4bc2.tar.xz
nixlib-ee4b56edd364922c6a20a8d7b21a5a72497b4bc2.tar.zst
nixlib-ee4b56edd364922c6a20a8d7b21a5a72497b4bc2.zip
Merge remote-tracking branch 'upstream/master' into staging
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix39
-rw-r--r--lib/meta.nix2
-rw-r--r--lib/strings.nix33
-rw-r--r--lib/systems/examples.nix9
-rw-r--r--lib/systems/parse.nix32
-rw-r--r--lib/systems/platforms.nix6
6 files changed, 73 insertions, 48 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 60ce01a93cd2..4ca2e2ea6e37 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -51,11 +51,11 @@ let
     # back-compat aliases
     platforms = systems.forMeta;
 
-    inherit (builtins) add addErrorContext attrNames
-      concatLists deepSeq elem elemAt filter genericClosure genList
-      getAttr hasAttr head isAttrs isBool isInt isList
-      isString length lessThan listToAttrs pathExists readFile
-      replaceStrings seq stringLength sub substring tail;
+    inherit (builtins) add addErrorContext attrNames concatLists
+      deepSeq elem elemAt filter genericClosure genList getAttr
+      hasAttr head isAttrs isBool isInt isList isString length
+      lessThan listToAttrs pathExists readFile replaceStrings seq
+      stringLength sub substring tail;
     inherit (trivial) id const concat or and boolToString mergeAttrs
       flip mapNullable inNixShell min max importJSON warn info
       nixpkgsVersion version mod compare splitByAndCompare
@@ -74,30 +74,32 @@ let
     inherit (lists) singleton foldr fold foldl foldl' imap0 imap1
       concatMap flatten remove findSingle findFirst any all count
       optional optionals toList range partition zipListsWith zipLists
-      reverseList listDfs toposort sort naturalSort compareLists take drop sublist
-      last init crossLists unique intersectLists subtractLists
-      mutuallyExclusive;
+      reverseList listDfs toposort sort naturalSort compareLists take
+      drop sublist last init crossLists unique intersectLists
+      subtractLists mutuallyExclusive;
     inherit (strings) concatStrings concatMapStrings concatImapStrings
       intersperse concatStringsSep concatMapStringsSep
       concatImapStringsSep makeSearchPath makeSearchPathOutput
       makeLibraryPath makeBinPath makePerlPath optionalString
       hasPrefix hasSuffix stringToCharacters stringAsChars escape
-      escapeShellArg escapeShellArgs replaceChars lowerChars upperChars
-      toLower toUpper addContextFrom splitString removePrefix
-      removeSuffix versionOlder versionAtLeast getVersion nameFromURL
-      enableFeature fixedWidthString fixedWidthNumber isStorePath
+      escapeShellArg escapeShellArgs replaceChars lowerChars
+      upperChars toLower toUpper addContextFrom splitString
+      removePrefix removeSuffix versionOlder versionAtLeast getVersion
+      nameFromURL enableFeature enableFeatureAs withFeature
+      withFeatureAs fixedWidthString fixedWidthNumber isStorePath
       toInt readPathsFromFile fileContents;
     inherit (stringsWithDeps) textClosureList textClosureMap
       noDepEntry fullDepEntry packEntry stringAfter;
     inherit (customisation) overrideDerivation makeOverridable
-      callPackageWith callPackagesWith extendDerivation
-      hydraJob makeScope;
+      callPackageWith callPackagesWith extendDerivation hydraJob
+      makeScope;
     inherit (meta) addMetaAttrs dontDistribute setName updateName
       appendToName mapDerivationAttrset lowPrio lowPrioSet hiPrio
       hiPrioSet;
     inherit (sources) pathType pathIsDirectory cleanSourceFilter
       cleanSource sourceByRegex sourceFilesBySuffices
-      commitIdFromGitRepo cleanSourceWith pathHasContext canCleanSource;
+      commitIdFromGitRepo cleanSourceWith pathHasContext
+      canCleanSource;
     inherit (modules) evalModules closeModules unifyModuleSyntax
       applyIfFunction unpackSubmodule packSubmodule mergeModules
       mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions
@@ -119,8 +121,7 @@ let
       traceXMLVal traceXMLValMarked traceSeq traceSeqN traceValSeq
       traceValSeqFn traceValSeqN traceValSeqNFn traceShowVal
       traceShowValMarked showVal traceCall traceCall2 traceCall3
-      traceValIfNot runTests testAllTrue traceCallXml
-      attrNamesToStr;
+      traceValIfNot runTests testAllTrue traceCallXml attrNamesToStr;
     inherit (misc) maybeEnv defaultMergeArg defaultMerge foldArgs
       defaultOverridableDelayableArgs composedArgsAndFun
       maybeAttrNullable maybeAttr ifEnable checkFlag getValue
@@ -129,7 +130,7 @@ let
       closePropagation mapAttrsFlatten nvs setAttr setAttrMerge
       mergeAttrsWithFunc mergeAttrsConcatenateValues
       mergeAttrsNoOverride mergeAttrByFunc mergeAttrsByFuncDefaults
-      mergeAttrsByFuncDefaultsClean mergeAttrBy
-      prepareDerivationArgs nixType imap overridableDelayableArgs;
+      mergeAttrsByFuncDefaultsClean mergeAttrBy prepareDerivationArgs
+      nixType imap overridableDelayableArgs;
   });
 in lib
diff --git a/lib/meta.nix b/lib/meta.nix
index 8516cc1cd6f1..199030c103af 100644
--- a/lib/meta.nix
+++ b/lib/meta.nix
@@ -86,6 +86,4 @@ rec {
         then { system = elem; }
         else { parsed = elem; };
     in lib.matchAttrs pattern platform;
-
-  enableIfAvailable = p: if p.meta.available or true then [ p ] else [];
 }
diff --git a/lib/strings.nix b/lib/strings.nix
index 61babf0b1aa3..e09ec42bfea2 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -414,6 +414,39 @@ rec {
   */
   enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}";
 
+  /* Create an --{enable-<feat>=<value>,disable-<feat>} string that can be passed to
+     standard GNU Autoconf scripts.
+
+     Example:
+       enableFeature true "shared" "foo"
+       => "--enable-shared=foo"
+       enableFeature false "shared" (throw "ignored")
+       => "--disable-shared"
+  */
+  enableFeatureAs = enable: feat: value: enableFeature enable feat + optionalString enable "=${value}";
+
+  /* Create an --{with,without}-<feat> string that can be passed to
+     standard GNU Autoconf scripts.
+
+     Example:
+       withFeature true "shared"
+       => "--with-shared"
+       withFeature false "shared"
+       => "--without-shared"
+  */
+  withFeature = with_: feat: "--${if with_ then "with" else "without"}-${feat}";
+
+  /* Create an --{with-<feat>=<value>,without-<feat>} string that can be passed to
+     standard GNU Autoconf scripts.
+
+     Example:
+       with_Feature true "shared" "foo"
+       => "--with-shared=foo"
+       with_Feature false "shared" (throw "ignored")
+       => "--without-shared"
+  */
+  withFeatureAs = with_: feat: value: withFeature with_ feat + optionalString with_ "=${value}";
+
   /* Create a fixed width string with additional prefix to match
      required width.
 
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index 7b34513d8378..07728c19fc9e 100644
--- a/lib/systems/examples.nix
+++ b/lib/systems/examples.nix
@@ -11,21 +11,16 @@ rec {
 
   sheevaplug = rec {
     config = "armv5tel-unknown-linux-gnueabi";
-    float = "soft";
     platform = platforms.sheevaplug;
   };
 
   raspberryPi = rec {
     config = "armv6l-unknown-linux-gnueabihf";
-    float = "hard";
-    fpu = "vfp";
     platform = platforms.raspberrypi;
   };
 
   armv7l-hf-multiplatform = rec {
     config = "armv7a-unknown-linux-gnueabihf";
-    float = "hard";
-    fpu = "vfpv3-d16";
     platform = platforms.armv7l-hf-multiplatform;
   };
 
@@ -47,26 +42,24 @@ rec {
 
   pogoplug4 = rec {
     config = "armv5tel-unknown-linux-gnueabi";
-    float = "soft";
     platform = platforms.pogoplug4;
   };
 
   ben-nanonote = rec {
     config = "mipsel-unknown-linux-uclibc";
-    float = "soft";
     platform = {
       name = "ben_nanonote";
       kernelMajor = "2.6";
       kernelArch = "mips";
       gcc = {
         arch = "mips32";
+        float = "soft";
       };
     };
   };
 
   fuloongminipc = rec {
     config = "mipsel-unknown-linux-gnu";
-    float = "hard";
     platform = platforms.fuloong2f_n32;
   };
 
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix
index 08f2fb445de3..1315f290cefa 100644
--- a/lib/systems/parse.nix
+++ b/lib/systems/parse.nix
@@ -190,9 +190,16 @@ rec {
   types.abi = enum (attrValues abis);
 
   abis = setTypes types.openAbi {
-    android = {};
-    cygnus = {};
-    gnu = {
+    cygnus       = {};
+    msvc         = {};
+    eabi         = {};
+
+    androideabi  = {};
+    android      = {};
+
+    gnueabi      = { float = "soft"; };
+    gnueabihf    = { float = "hard"; };
+    gnu          = {
       assertions = [
         { assertion = platform: !platform.isAarch32;
           message = ''
@@ -201,17 +208,14 @@ rec {
         }
       ];
     };
-    msvc = {};
-    eabi = {};
-    androideabi = {};
-    gnueabi = {};
-    gnueabihf = {};
-    musleabi = {};
-    musleabihf = {};
-    musl = {};
-    uclibceabihf = {};
-    uclibceabi = {};
-    uclibc = {};
+
+    musleabi     = { float = "soft"; };
+    musleabihf   = { float = "hard"; };
+    musl         = {};
+
+    uclibceabihf = { float = "soft"; };
+    uclibceabi   = { float = "hard"; };
+    uclibc       = {};
 
     unknown = {};
   };
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix
index f39e890fbf1c..d6587ac49a89 100644
--- a/lib/systems/platforms.nix
+++ b/lib/systems/platforms.nix
@@ -25,7 +25,6 @@ rec {
 
     gcc = {
       arch = "armv5te";
-      float = "soft";
     };
 
     kernelMajor = "2.6";
@@ -158,7 +157,6 @@ rec {
     kernelDTB = true; # Beyond 3.10
     gcc = {
       arch = "armv5te";
-      float = "soft";
     };
   };
 
@@ -336,7 +334,6 @@ rec {
     gcc = {
       cpu = "cortex-a9";
       fpu = "vfpv3";
-      float = "hard";
     };
   };
 
@@ -363,7 +360,6 @@ rec {
     gcc = {
       cpu = "cortex-a9";
       fpu = "neon";
-      float = "hard";
     };
   };
 
@@ -449,6 +445,7 @@ rec {
     kernelTarget = "vmlinux";
     gcc = {
       arch = "loongson2f";
+      float = "hard";
       abi = "n32";
     };
   };
@@ -498,7 +495,6 @@ rec {
       # and the above page suggests NEON is only an improvement with hand-written assembly.
       arch = "armv7-a";
       fpu = "vfpv3-d16";
-      float = "hard";
 
       # For Raspberry Pi the 2 the best would be:
       #   cpu = "cortex-a7";