From 2a9345daf1902801373d754d54da29dddccffad1 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Fri, 21 Nov 2025 16:18:01 -0800 Subject: [PATCH] haskell: export build flags as a shell variable This is useful so that you can call `Setup build` on other targets e.g. for code generation while still having the same flags. The context that led me to write this patch is that we have HIE file generation in an overlay at work and I was packaging Glean, which requires a code gen component get built, and it was building twice due to the hie flags not getting propagated to the Setup build commands I was running manually. --- pkgs/development/haskell-modules/generic-builder.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 5cebe4aec5d0..6e3994c54a24 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -302,8 +302,6 @@ let makeGhcOptions = opts: lib.concatStringsSep " " (map (opt: "--ghc-option=${opt}") opts); - buildFlagsString = optionalString (buildFlags != [ ]) (" " + concatStringsSep " " buildFlags); - defaultConfigureFlags = [ "--verbose" "--prefix=$out" @@ -735,7 +733,7 @@ lib.fix ( # Cabal takes flags like `--configure-option=--host=...` instead configurePlatforms = [ ]; - inherit configureFlags; + inherit configureFlags buildFlags; # Note: the options here must be always added, regardless of whether the # package specifies `hardeningDisable`. @@ -769,7 +767,7 @@ lib.fix ( find dist/build -exec touch -d '1970-01-01T00:00:00Z' {} + '' + '' - ${setupCommand} build ${buildTarget}${buildFlagsString} + ${setupCommand} build ${buildTarget} $buildFlags runHook postBuild '';