about summary refs log tree commit diff
path: root/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix')
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix173
1 files changed, 102 insertions, 71 deletions
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
index 82e8889f6cf4d..849d2b1da3fbf 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
@@ -1,82 +1,113 @@
-{ lib
-, stdenvNoCC, stdenv
-, fetchNetBSD
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, tsort, lorder
-, mandoc, groff, statHook, rsync
-, compatIfNeeded
-, defaultMakeFlags
+{
+  lib,
+  stdenvNoCC,
+  stdenv,
+  fetchNetBSD,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  groff,
+  statHook,
+  rsync,
+  compatIfNeeded,
+  defaultMakeFlags,
 }:
 
-lib.makeOverridable (attrs: let
-  stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
-in stdenv'.mkDerivation ({
-  pname = "${attrs.pname or (baseNameOf attrs.path)}-netbsd";
-  inherit (attrs) version;
-  src = fetchNetBSD attrs.path attrs.version attrs.sha256;
+lib.makeOverridable (
+  attrs:
+  let
+    stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
+  in
+  stdenv'.mkDerivation (
+    {
+      pname = "${attrs.pname or (baseNameOf attrs.path)}-netbsd";
+      inherit (attrs) version;
+      src = fetchNetBSD attrs.path attrs.version attrs.sha256;
 
-  extraPaths = [ ];
+      extraPaths = [ ];
 
-  nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
-    makeMinimal
-    install tsort lorder mandoc groff statHook rsync
-  ];
-  buildInputs = compatIfNeeded;
+      nativeBuildInputs = [
+        bsdSetupHook
+        netbsdSetupHook
+        makeMinimal
+        install
+        tsort
+        lorder
+        mandoc
+        groff
+        statHook
+        rsync
+      ];
+      buildInputs = compatIfNeeded;
 
-  HOST_SH = stdenv'.shell;
+      HOST_SH = stdenv'.shell;
 
-  MACHINE_ARCH = {
-    i486 = "i386";
-    i586 = "i386";
-    i686 = "i386";
-  }.${stdenv'.hostPlatform.parsed.cpu.name}
-    or stdenv'.hostPlatform.parsed.cpu.name;
+      MACHINE_ARCH =
+        {
+          i486 = "i386";
+          i586 = "i386";
+          i686 = "i386";
+        }
+        .${stdenv'.hostPlatform.parsed.cpu.name} or stdenv'.hostPlatform.parsed.cpu.name;
 
-  MACHINE = {
-    x86_64 = "amd64";
-    aarch64 = "evbarm64";
-    i486 = "i386";
-    i586 = "i386";
-    i686 = "i386";
-  }.${stdenv'.hostPlatform.parsed.cpu.name}
-    or stdenv'.hostPlatform.parsed.cpu.name;
+      MACHINE =
+        {
+          x86_64 = "amd64";
+          aarch64 = "evbarm64";
+          i486 = "i386";
+          i586 = "i386";
+          i686 = "i386";
+        }
+        .${stdenv'.hostPlatform.parsed.cpu.name} or stdenv'.hostPlatform.parsed.cpu.name;
 
-  COMPONENT_PATH = attrs.path;
+      COMPONENT_PATH = attrs.path;
 
-  makeFlags = defaultMakeFlags;
+      makeFlags = defaultMakeFlags;
 
-  strictDeps = true;
+      strictDeps = true;
 
-  meta = with lib; {
-    maintainers = with maintainers; [ matthewbauer qyliss ];
-    platforms = platforms.unix;
-    license = licenses.bsd2;
-  };
-
-} // lib.optionalAttrs stdenv'.hasCC {
-  # TODO should CC wrapper set this?
-  CPP = "${stdenv'.cc.targetPrefix}cpp";
-} // lib.optionalAttrs stdenv'.isDarwin {
-  MKRELRO = "no";
-} // lib.optionalAttrs (stdenv'.cc.isClang or false) {
-  HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc);
-} // lib.optionalAttrs (stdenv'.cc.isGNU or false) {
-  HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc);
-} // lib.optionalAttrs (stdenv'.isx86_32) {
-  USE_SSP = "no";
-} // lib.optionalAttrs (attrs.headersOnly or false) {
-  installPhase = "includesPhase";
-  dontBuild = true;
-} // attrs // {
-  # Files that use NetBSD-specific macros need to have nbtool_config.h
-  # included ahead of them on non-NetBSD platforms.
-  postPatch = lib.optionalString (!stdenv'.hostPlatform.isNetBSD) ''
-    set +e
-    grep -Zlr "^__RCSID
-    ^__BEGIN_DECLS" $COMPONENT_PATH | xargs -0r grep -FLZ nbtool_config.h |
-        xargs -0tr sed -i '0,/^#/s//#include <nbtool_config.h>\n\0/'
-    set -e
-  '' + attrs.postPatch or "";
-}))
+      meta = with lib; {
+        maintainers = with maintainers; [
+          matthewbauer
+          qyliss
+        ];
+        platforms = platforms.unix;
+        license = licenses.bsd2;
+      };
+    }
+    // lib.optionalAttrs stdenv'.hasCC {
+      # TODO should CC wrapper set this?
+      CPP = "${stdenv'.cc.targetPrefix}cpp";
+    }
+    // lib.optionalAttrs stdenv'.isDarwin { MKRELRO = "no"; }
+    // lib.optionalAttrs (stdenv'.cc.isClang or false) {
+      HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc);
+    }
+    // lib.optionalAttrs (stdenv'.cc.isGNU or false) {
+      HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc);
+    }
+    // lib.optionalAttrs (stdenv'.isx86_32) { USE_SSP = "no"; }
+    // lib.optionalAttrs (attrs.headersOnly or false) {
+      installPhase = "includesPhase";
+      dontBuild = true;
+    }
+    // attrs
+    // {
+      # Files that use NetBSD-specific macros need to have nbtool_config.h
+      # included ahead of them on non-NetBSD platforms.
+      postPatch =
+        lib.optionalString (!stdenv'.hostPlatform.isNetBSD) ''
+          set +e
+          grep -Zlr "^__RCSID
+          ^__BEGIN_DECLS" $COMPONENT_PATH | xargs -0r grep -FLZ nbtool_config.h |
+              xargs -0tr sed -i '0,/^#/s//#include <nbtool_config.h>\n\0/'
+          set -e
+        ''
+        + attrs.postPatch or "";
+    }
+  )
+)