Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-17 Thread Bas van Dijk
Note that the regular expression that builtins.match accepts already supports disjunction using: "a|b". So your example application could be rewritten using: sourceByRegex /tmp/sourcetest [".*hs$|someTestFile"] suggesting that the list of regexes could be replaced by a single regex:

Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-17 Thread Bas van Dijk
Awesome function indeed! TIL there exists builtins.match and it's not documented in the manual[1]. I would like to switch from my whitelistSource to your sourceByRegex so a PR would be much appreciated indeed. Bas [1] http://nixos.org/nix/manual/#ssec-builtins On 17 February 2017 at 11:16,

Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-17 Thread Maarten Hoogendoorn
Awesome function Thomas! Would you be willing to open a PR on nixpkgs for that? 2017-02-17 11:16 GMT+01:00 Thomas Hunger : > Thanks for your replies everyone! > > Bas - your "toString" helped me over the finishing line. Pretty obvious in > hindsight to use toString to force

Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-17 Thread Thomas Hunger
Thanks for your replies everyone! Bas - your "toString" helped me over the finishing line. Pretty obvious in hindsight to use toString to force evaluation of src. I adapted your code to this: sourceByRegex = src: regexes: builtins.filterSource (path: type: let relPath = lib.removePrefix

Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-16 Thread Bas van Dijk
At LumiGuide we're using the following function in our Haskell packages: # Copy everything under src into the Nix store except those paths that don't # have one of the specified allowedPrefixes. whitelistSource = src: allowedPrefixes: builtins.filterSource (path: type:

Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-16 Thread zimbatm
I've been using filterSource. It works okay but is a bit too generic. It would be nice to have a function that understands a gitignore-like syntax. On Thu, 16 Feb 2017, 12:44 Profpatsch, wrote: > On 17-02-16 01:28pm, Freddy Rietdijk wrote: > > > src = [

Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-16 Thread Profpatsch
On 17-02-16 01:28pm, Freddy Rietdijk wrote: > > src = [ ./subproject-A/schema.sql ./subproject-A/lib ]; > > Each of the files you mentioned here will be stored in a separate store > path. You could write a simple function that takes a list of derivations > and copies the contents of those

Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-16 Thread Linus Heckemann
On 16/02/17 12:28, Freddy Rietdijk wrote: >> src = [ ./subproject-A/schema.sql ./subproject-A/lib ]; > > Each of the files you mentioned here will be stored in a separate store > path. You could write a simple function that takes a list of derivations > and copies the contents of those

Re: [Nix-dev] Explicitly selecting sources for "src" in stdenv.mkDerivation?

2017-02-16 Thread Freddy Rietdijk
> src = [ ./subproject-A/schema.sql ./subproject-A/lib ]; Each of the files you mentioned here will be stored in a separate store path. You could write a simple function that takes a list of derivations and copies the contents of those derivations in a new output. On Thu, Feb 16, 2017 at 1:14