Skip to content

Instantly share code, notes, and snippets.

@expipiplus1
Created August 11, 2016 11:06
Show Gist options
  • Save expipiplus1/39dd6ab5eb530a4cf2693de5b7d844ef to your computer and use it in GitHub Desktop.
Save expipiplus1/39dd6ab5eb530a4cf2693de5b7d844ef to your computer and use it in GitHub Desktop.
# If this source is local, strip a bunch of things from the source before
# building to make the hash change a little less often on local machines.
# This doesn't filter non-local sources.
maybeFilterSource = src:
if !isList src &&
!isFunction src &&
!isDerivation src &&
!isStorePath src
then defaultSourceFilter src
else src;
# Filter source with some sensible defaults
defaultSourceFilter =
builtins.filterSource (path: type:
type != "unknown" &&
baseNameOf path != ".gitignore" &&
baseNameOf path != "result" &&
!(hasSuffix "~" path) &&
(baseNameOf path == ".git" -> type != "directory") &&
(baseNameOf path == "dist" -> type != "directory") &&
(baseNameOf path == "make" -> type != "directory") &&
(baseNameOf path == ".stack-work" -> type != "directory")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment