Skip to content

Instantly share code, notes, and snippets.

@nathan-at-least
Created October 12, 2020 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathan-at-least/0d8b5b15779833fa638eb5733f4caa07 to your computer and use it in GitHub Desktop.
Save nathan-at-least/0d8b5b15779833fa638eb5733f4caa07 to your computer and use it in GitHub Desktop.
Failing to filter source appropriately in a nix build.
let
inherit (builtins) any filterSource;
nixpkgs = import ./nixpkgs.nix;
inherit (nixpkgs.lib.debug) traceSeq traceVal;
# Parent of util is nix.
# Parent of nix is srcDir:
rawSrcDir = ../../..;
_skipPaths = map (n: rawSrcDir + "/${n}") [
".git"
"nix"
];
skipPaths = traceSeq "${builtins.toJSON _skipPaths}" _skipPaths;
selectPath = path: kind:
let
isSkipPath = skipPath:
traceSeq "Comparing path ${path} to skipPath ${skipPath}" (
path == skipPath
);
in
!(any isSkipPath skipPaths);
in
filterSource selectPath rawSrcDir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment