Skip to content

cabalProject': Consider cabalProjectLocal even if cabalProject argument is null #1588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,15 @@ let
# access to the store is restricted. If origSrc was already in the store
# you can pass the project in as a string.
rawCabalProject =
if cabalProject != null
then cabalProject + (
if cabalProjectLocal != null
then ''

-- Added from cabalProjectLocal argument to cabalProject
${cabalProjectLocal}
''
else ""
)
else null;
# Even if `cabal.project` doesn't exist, `cabal.project.local` is still used by cabal.
# We tested this: https://github.com/input-output-hk/haskell.nix/pull/1588
if cabalProject == null && cabalProjectLocal == null
then null
else (
# like fmap
let f = g: x: if x == null then "" else g x; in
f (x: x) cabalProject + f (x: "\n-- Added from cabalProjectLocal argument to cabalProject\n${x}") cabalProjectLocal
);

cabalProjectIndexState =
if rawCabalProject != null
Expand Down
3 changes: 0 additions & 3 deletions modules/hackage-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ in {
# Avoid readDir and readFile IFD functions looking for these files in the hackage source
# `mkOverride 1100` means this will be used in preference to the mkOption default,
# but a `mkDefault` can still override this.
cabalProject = lib.mkOverride 1100 ''
packages: .
'';
cabalProjectLocal = lib.mkOverride 1100 null;
cabalProjectFreeze = lib.mkOverride 1100 null;
src =
Expand Down