From 11ab35533afaf0cacc5f3ed8032cb2482cedf8fd Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar <3998+srid@users.noreply.github.com> Date: Thu, 27 Apr 2023 12:57:56 -0400 Subject: [PATCH] exe: Use `getBin` instead of `justStaticExecutables` (#151) --- CHANGELOG.md | 1 + nix/flake-module.nix | 5 +++-- nix/haskell-project.nix | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de93dfb..b4deaa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - #138: Add `checks` to `outputs` submodule - #143: Changed `autoWire` to be an enum type, for granular controlling of which outputs to autowire. - #137: Expose cabal executables as flake apps. Add a corresponding `outputs.apps` option, while the `outputs.localPackages` option is renamed to `outputs.packages` (it now contains package metadata, including packages and its executables). + - #151: Use `lib.getBin` to get the bin output - #148: Remove automatic hpack->cabal generation. Use `pre-commit-hooks.nix` instead. - #149: Fix unnecessary re-runs of cabal2nix evaluation. Add a `debug` option to have haskell-flake produce diagnostic messages. diff --git a/nix/flake-module.nix b/nix/flake-module.nix index 76d5d5c..a5d8049 100644 --- a/nix/flake-module.nix +++ b/nix/flake-module.nix @@ -176,8 +176,9 @@ in description = '' Attrset of executables from `.cabal` file. - The executables are accessed without any reference to the - Haskell library, using `justStaticExecutables`. + If the associated Haskell project has a separate bin output + (cf. `enableSeparateBinOutput`), then this exes will refer + only to the bin output. NOTE: Evaluating up to this option will involve IFD. ''; diff --git a/nix/haskell-project.nix b/nix/haskell-project.nix index e8f00ec..544e143 100644 --- a/nix/haskell-project.nix +++ b/nix/haskell-project.nix @@ -72,13 +72,12 @@ in exes = let exeNames = haskell-parsers.getCabalExecutables value.root; - staticPackage = pkgs.haskell.lib.justStaticExecutables finalPackages.${name}; in lib.listToAttrs (map (exe: lib.nameValuePair exe { - program = "${staticPackage}/bin/${exe}"; + program = "${lib.getBin finalPackages.${name}}/bin/${exe}"; } ) exeNames