about summary refs log tree commit diff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-02-28 17:11:35 -0500
committerShea Levy <shea@shealevy.com>2018-02-28 17:11:35 -0500
commit8a60691dc6695ce455d3c6de07ceb2e58aa9c0c6 (patch)
tree1644c49abf4baee4865b17890db96dc6d168ab82
parent5ff15fbf7d3b6e8eb9aac982459ebd8d081c97f0 (diff)
parent7f623cfa45d3262e37f7961efe2c02406a94f4b6 (diff)
downloadnixlib-8a60691dc6695ce455d3c6de07ceb2e58aa9c0c6.tar
nixlib-8a60691dc6695ce455d3c6de07ceb2e58aa9c0c6.tar.gz
nixlib-8a60691dc6695ce455d3c6de07ceb2e58aa9c0c6.tar.bz2
nixlib-8a60691dc6695ce455d3c6de07ceb2e58aa9c0c6.tar.lz
nixlib-8a60691dc6695ce455d3c6de07ceb2e58aa9c0c6.tar.xz
nixlib-8a60691dc6695ce455d3c6de07ceb2e58aa9c0c6.tar.zst
nixlib-8a60691dc6695ce455d3c6de07ceb2e58aa9c0c6.zip
Merge branch 'callCabal2nix-restricted'
-rw-r--r--pkgs/build-support/safe-discard-string-context.nix14
-rw-r--r--pkgs/development/haskell-modules/make-package-set.nix15
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 7 insertions, 24 deletions
diff --git a/pkgs/build-support/safe-discard-string-context.nix b/pkgs/build-support/safe-discard-string-context.nix
deleted file mode 100644
index 293a15295d55..000000000000
--- a/pkgs/build-support/safe-discard-string-context.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-# | Discard the context of a string while ensuring that expected path
-# validity invariants hold.
-#
-# This relies on import-from-derivation, but it is only useful in
-# contexts where the string is going to be used in an
-# import-from-derivation anyway.
-#
-# safeDiscardStringContext : String → String
-{ writeText }: s:
-  builtins.seq
-    (import (writeText
-               "discard.nix"
-               "${builtins.substring 0 0 s}null\n"))
-    (builtins.unsafeDiscardStringContext s)
diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix
index 2c628eff5622..458c4eae136d 100644
--- a/pkgs/development/haskell-modules/make-package-set.nix
+++ b/pkgs/development/haskell-modules/make-package-set.nix
@@ -148,14 +148,13 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
     callCabal2nix = name: src: args:
       overrideCabal (self.callPackage (haskellSrc2nix {
         inherit name;
-        src = pkgs.lib.cleanSourceWith
-          { src = if pkgs.lib.canCleanSource src
-                    then src
-                    else pkgs.safeDiscardStringContext src;
-            filter = path: type:
-              pkgs.lib.hasSuffix "${name}.cabal" path ||
-              pkgs.lib.hasSuffix "package.yaml" path;
-          };
+        src =
+          let filter = path: type:
+                pkgs.lib.hasSuffix "${name}.cabal" path ||
+                baseNameOf path == "package.yaml";
+          in if pkgs.lib.canCleanSource src
+               then pkgs.lib.cleanSourceWith { inherit src filter; }
+             else src;
       }) args) (_: { inherit src; });
 
     # : { root : Path
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 62a9e9714d92..b79099c28bdf 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -20842,8 +20842,6 @@ with pkgs;
 
   tlwg = callPackage ../data/fonts/tlwg { };
 
-  safeDiscardStringContext = callPackage ../build-support/safe-discard-string-context.nix { };
-
   simplehttp2server = callPackage ../servers/simplehttp2server { };
 
   diceware = callPackage ../tools/security/diceware { };