on iko/ghcjs-patch-master help sign in
Fix filtering package in root of project (#1041)
39560d4Hamish Mackenzie
lib/clean-cabal-component.nix+10−3
@@ -37,9 +37,16 @@ let
37 then "/"
37 then "/"
38 else ""
38 else ""
39 ) + normalizeRelativePath path;
39 ) + normalizeRelativePath path;
40+ combinePaths = a: b:
40− combinePaths = a: b: if isAbsolutePath b
41+ if isAbsolutePath b
41− then b
42+ then b
42− else normalizePath (a + "/" + b);
43+ else normalizePath (
44+ if a == ""
45+ then b
46+ else if b == ""
47+ then a
48+ else a + "/" + b
49+ );
43 # Like normalizePath but with a trailing / when needed
50 # Like normalizePath but with a trailing / when needed
44 normalizeDir = dir:
51 normalizeDir = dir:
45 let p = normalizePath dir;
52 let p = normalizePath dir;
lib/default.nix+12−9
@@ -314,14 +314,17 @@ in {
314 rootAndSubDir = src: rec {
314 rootAndSubDir = src: rec {
315 subDir = src.origSubDir or "";
315 subDir = src.origSubDir or "";
316 root =
316 root =
317+ if subDir == ""
318+ then src # if there was no subdir use the original src
319+ else
317− # Use `cleanSourceWith` to make sure the `filter` is still used
320+ # Use `cleanSourceWith` to make sure the `filter` is still used
318− if src ? origSrc && src ? filter && subDir != ""
321+ if src ? origSrc && src ? filter
319− then haskellLib.cleanSourceWith {
322+ then haskellLib.cleanSourceWith {
320− name = src.name or "source" + "-root";
323+ name = src.name or "source" + "-root";
321− src = src.origSrc;
324+ src = src.origSrc;
322− # Not passing src.origSubDir so that the result points `origSrc`
325+ # Not passing src.origSubDir so that the result points `origSrc`
323− inherit (src) filter;
326+ inherit (src) filter;
324− }
327+ }
325− else src.origSrc or src;
328+ else src.origSrc or src; # If there is a subDir and origSrc (but no filter) use origSrc
326 };
329 };
327}
330}