Merge branch 'callCabal2nix-restricted'

This commit is contained in:
Shea Levy 2018-02-28 17:11:35 -05:00
commit 8a60691dc6
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27
3 changed files with 7 additions and 24 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 { };