Ok, I’ve succeeded now. The important points are:
- Invoking
unpackPhasein a nix-shell does not work as expected; I have to useeval $unpackPhase, see RFC 32 - Undocumented attribute “name” for fetchFromGitHub (and probably others):
Ifsrcsis used to use several source-files, thename-attribute for fetchFromGitHub etc. is essential – but unfortunately, this is not documented.
(I guess I have to create a bugreport to fix this documentation-bug.) - Setting
sourceRoot
Template for a simple solution with multiple sources (here: test and src2):
stdenv.mkDerivation rec {
pname = "test";
version = "1.0";
srcs = [
(fetchFromGitHub {
owner = "...";
repo = "...";
rev = version;
name = pname;
sha256 = "...";
})
(fetchFromGitHub {
owner = "...";
repo = "...";
rev = "...";
name = "src2";
sha256 = "...";
})
];
sourceRoot = pname;
buildInputs = [ ... ];
preBuild = ''
chmod -R u+w ../src2
ln -s ../src2 .
make ../src2
'';
meta = {
...
};
}