Mix local and remote sources


I’ve got a package which gets build from the local sources as:

  whitelistSource = src: allowedPrefixes:
      (path: type:
            lib.hasPrefix (toString (src + "/${allowedPrefix}")) path)
src = whitelistSource ../../../. [

Now I have a dependency to a path in a repo which i can fetch using fetchFromGitHub.
How can I combine both sources?
I’ve tried using srcs = [local… remote + “/folder” ]; but that seems to fetch what’s inside /folder rather than the “/folder”, if that makes sense. Also the build ends up failing with “unpacker produced multiple directories”.


What do you mean by combining the sources? You could use runComandNoCC to create a new derivation by doing something like this:

let final = pkgs.runCommadNoCC "build-final.sh" {} ''
  mkdir $out
  cp ${src1} $out/
  cp ${src2}/whatever $out/

By combining the sources I mean using both local sources from my repo plus a few folders from a remote github repo. Let’s say locally I have have file1.txt but I also need file2.txt which is located in github.com/org/repo/folder1/file2.txt.

Thank you, I’ll have a look at that runcommand :+1: