@@ -24,30 +24,43 @@ in project // {
24 packages = pkgs.lib.attrsets.mapAttrs (name: value:
24 packages = pkgs.lib.attrsets.mapAttrs (name: value:
25 if builtins.isFunction value
25 if builtins.isFunction value
26 then value
26 then value
27− else {...}@args:
27+ else {...}@args: with pkgs.lib.strings;
28− let oldPkg = import value args;
29+ oldPkg = import value args;
29− packageSrc = if !pkgs.lib.strings.hasPrefix (toString projectNix) (toString oldPkg.src.content)
30+ # When the package src is in the project dir, this is the subDir it is in.
30− then toString oldPkg.src.content
32− subDir = pkgs.lib.strings.removePrefix "/" (
33− pkgs.lib.strings.removePrefix (toString projectNix)
31+ subDir = removePrefix "/" (removePrefix (toString projectNix)
34− (toString oldPkg.src.content));
32+ (toString oldPkg.src.content));
35− srcRepoPrefix = projectSubDir'' + ".source-repository-packages/";
33+ srcRepoPrefix = projectSubDir'' + ".source-repository-packages/";
36+ if !hasPrefix (toString projectNix) (toString oldPkg.src.content)
38+ # Source location does not match project prefix
40+ packageSrc = toString oldPkg.src.content;
36− in if pkgs.lib.strings.hasPrefix srcRepoPrefix subDir
42+ else if hasPrefix srcRepoPrefix subDir
44+ # The source is from a source repository
38− pkgs.lib.lists.elemAt sourceRepos (
46+ packageSrc = pkgs.lib.lists.elemAt sourceRepos (
39− pkgs.lib.strings.toInt (pkgs.lib.strings.removePrefix srcRepoPrefix subDir))
47+ toInt (removePrefix srcRepoPrefix subDir));
50+ # Source does match project prefix and it is not from a source repository
40− else haskellLib.appendSubDir {
52+ packageSrc = haskellLib.appendSubDir {
41− src = srcRoot;
53+ src = srcRoot;
42− inherit subDir;
54+ inherit subDir;
43− includeSiblings = true; # Filtering sibling dirs of the package dir is done in the
55+ includeSiblings = true; # Filtering sibling dirs of the package dir is done in the
44− # component builder so that relative paths can be used to
56+ # component builder so that relative paths can be used to
45− # reference project directories not in the package subDir.
57+ # reference project directories not in the package subDir.
47 in oldPkg // {
60 in oldPkg // {
48− src = (pkgs.lib).mkDefault packageSrc;
61+ src = (pkgs.lib).mkDefault packageInfo.packageSrc;
49 package = oldPkg.package // {
62 package = oldPkg.package // {
50− isProject = (pkgs.lib).mkDefault true;
63+ isProject = (pkgs.lib).mkDefault packageInfo.isProject;