Skip to content

Commit

Permalink
fix: avoid "used but not defined" error with empty outputs.packages
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Apr 22, 2024
1 parent d9287fe commit 56c45af
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nix/modules/project/outputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ in
);
};

# To fix the following error with lib.mkMerge
# error: The option `perSystem.aarch64-darwin.haskellProjects.default.outputs.apps' is used but not defined.
mkMergeHandlingEmpty = xs:
if xs == [ ] then { } else lib.mkMerge xs;

in
{
outputs = {
Expand All @@ -112,7 +117,7 @@ in
packages = lib.mapAttrs buildPackageInfo localPackages;

apps =
lib.mkMerge
mkMergeHandlingEmpty
(lib.mapAttrsToList (_: packageInfo: packageInfo.exes) config.outputs.packages);
};
};
Expand Down

0 comments on commit 56c45af

Please sign in to comment.