callCabal2nix: Fix filtering for non-cleanSourceable sources.
What was here before wasn't correct anyway, and now it works in restricted mode. Fixes #35207
This commit is contained in:
parent
edf0a76211
commit
7f623cfa45
|
@ -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)
|
|
|
@ -148,14 +148,13 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
|
||||||
callCabal2nix = name: src: args:
|
callCabal2nix = name: src: args:
|
||||||
overrideCabal (self.callPackage (haskellSrc2nix {
|
overrideCabal (self.callPackage (haskellSrc2nix {
|
||||||
inherit name;
|
inherit name;
|
||||||
src = pkgs.lib.cleanSourceWith
|
src =
|
||||||
{ src = if pkgs.lib.canCleanSource src
|
let filter = path: type:
|
||||||
then src
|
pkgs.lib.hasSuffix "${name}.cabal" path ||
|
||||||
else pkgs.safeDiscardStringContext src;
|
baseNameOf path == "package.yaml";
|
||||||
filter = path: type:
|
in if pkgs.lib.canCleanSource src
|
||||||
pkgs.lib.hasSuffix "${name}.cabal" path ||
|
then pkgs.lib.cleanSourceWith { inherit src filter; }
|
||||||
pkgs.lib.hasSuffix "package.yaml" path;
|
else src;
|
||||||
};
|
|
||||||
}) args) (_: { inherit src; });
|
}) args) (_: { inherit src; });
|
||||||
|
|
||||||
# : { root : Path
|
# : { root : Path
|
||||||
|
|
|
@ -20842,8 +20842,6 @@ with pkgs;
|
||||||
|
|
||||||
tlwg = callPackage ../data/fonts/tlwg { };
|
tlwg = callPackage ../data/fonts/tlwg { };
|
||||||
|
|
||||||
safeDiscardStringContext = callPackage ../build-support/safe-discard-string-context.nix { };
|
|
||||||
|
|
||||||
simplehttp2server = callPackage ../servers/simplehttp2server { };
|
simplehttp2server = callPackage ../servers/simplehttp2server { };
|
||||||
|
|
||||||
diceware = callPackage ../tools/security/diceware { };
|
diceware = callPackage ../tools/security/diceware { };
|
||||||
|
|
Loading…
Reference in a new issue