diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-12-20 06:11:26 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-01-03 19:18:16 +0000 |
commit | f52263ced0937e72453e7fbce9fefb5f425f650b (patch) | |
tree | 55b8627bc37cfdc7ce683f14b6180609fa7e3dbe /pkgs/os-specific | |
parent | 0df75bc04e14e4af11e0124791bfd41bbff51b88 (diff) |
treewide: Start to break up static overlay
We can use use `stdenv.hostPlatform.isStatic` instead, and move the logic per package. The least opionated benefit of this is that it makes it much easier to replace packages with modified ones, as there is no longer any issue of overlay order. CC @FRidh @matthewbauer
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r-- | pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix | 4 | ||||
-rw-r--r-- | pkgs/os-specific/linux/busybox/default.nix | 2 | ||||
-rw-r--r-- | pkgs/os-specific/linux/libcap/default.nix | 20 |
3 files changed, 15 insertions, 11 deletions
diff --git a/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix index 0532c88b66b9f..72ef086f59909 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix @@ -1,6 +1,6 @@ { stdenv, appleDerivation, lib -, enableStatic ? stdenv.targetPlatform.isiOS -, enableShared ? !stdenv.targetPlatform.isiOS +, enableStatic ? stdenv.hostPlatform.isStatic +, enableShared ? !stdenv.hostPlatform.isStatic }: appleDerivation { diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix index 026ea6fd2e8e4..99909e6262efa 100644 --- a/pkgs/os-specific/linux/busybox/default.nix +++ b/pkgs/os-specific/linux/busybox/default.nix @@ -1,5 +1,5 @@ { stdenv, lib, buildPackages, fetchurl, fetchFromGitLab -, enableStatic ? false +, enableStatic ? stdenv.hostPlatform.isStatic , enableMinimal ? false # Allow forcing musl without switching stdenv itself, e.g. for our bootstrapping: # nix build -f pkgs/top-level/release.nix stdenvBootstrapTools.x86_64-linux.dist diff --git a/pkgs/os-specific/linux/libcap/default.nix b/pkgs/os-specific/linux/libcap/default.nix index 713c4b5d13d96..ab78a3a33d8fa 100644 --- a/pkgs/os-specific/linux/libcap/default.nix +++ b/pkgs/os-specific/linux/libcap/default.nix @@ -1,5 +1,9 @@ -{ stdenv, lib, buildPackages, fetchurl, attr, perl, pam -, static ? stdenv.targetPlatform.isStatic }: +{ stdenv, lib, buildPackages, fetchurl, attr, perl +, usePam ? !isStatic, pam ? null +, isStatic ? stdenv.hostPlatform.isStatic +}: + +assert usePam -> pam != null; stdenv.mkDerivation rec { pname = "libcap"; @@ -10,21 +14,21 @@ stdenv.mkDerivation rec { sha256 = "1qf80lifygbnxwvqjf8jz5j24n6fqqx4ixnkbf76xs2vrmcq664j"; }; - patches = lib.optional static ./no-shared-lib.patch; + patches = lib.optional isStatic ./no-shared-lib.patch; outputs = [ "out" "dev" "lib" "man" "doc" ] - ++ lib.optional (pam != null) "pam"; + ++ lib.optional usePam "pam"; depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ perl ]; - buildInputs = [ pam ]; + buildInputs = lib.optional usePam pam; propagatedBuildInputs = [ attr ]; makeFlags = [ "lib=lib" - "PAM_CAP=${if pam == null then "no" else "yes"}" + "PAM_CAP=${if usePam then "yes" else "no"}" "BUILD_CC=$(CC_FOR_BUILD)" "CC:=$(CC)" ]; @@ -48,10 +52,10 @@ stdenv.mkDerivation rec { installFlags = [ "RAISE_SETFCAP=no" ]; postInstall = '' - ${lib.optionalString (!static) ''rm "$lib"/lib/*.a''} + ${lib.optionalString (!isStatic) ''rm "$lib"/lib/*.a''} mkdir -p "$doc/share/doc/${pname}-${version}" cp License "$doc/share/doc/${pname}-${version}/" - '' + stdenv.lib.optionalString (pam != null) '' + '' + stdenv.lib.optionalString usePam '' mkdir -p "$pam/lib/security" mv "$lib"/lib/security "$pam/lib" ''; |