From 1ca25ec71fbb4b97a32ff7747c2e761c5d451f40 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Thu, 27 Apr 2023 11:52:52 -0400 Subject: [PATCH] Log the default 'packages' value --- CHANGELOG.md | 2 +- nix/flake-module.nix | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 298d5c9..de93dfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - #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). - #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 enable produce verbose diagnostic messages. +- #149: Fix unnecessary re-runs of cabal2nix evaluation. Add a `debug` option to have haskell-flake produce diagnostic messages. ## 0.2.0 (Mar 13, 2023) diff --git a/nix/flake-module.nix b/nix/flake-module.nix index 0b4f3a6..76d5d5c 100644 --- a/nix/flake-module.nix +++ b/nix/flake-module.nix @@ -18,7 +18,6 @@ in let appType = import ./types/app-type.nix { inherit pkgs lib; }; haskellOverlayType = import ./types/haskell-overlay-type.nix { inherit lib; }; - log = import ./logging.nix { }; hlsCheckSubmodule = types.submodule { options = { @@ -189,7 +188,10 @@ in specialArgs = { inherit pkgs self; }; modules = [ ./haskell-project.nix - ({ config, ... }: + ({ config, name, ... }: + let + log = import ./logging.nix { inherit (config) debug; }; + in { options = { projectRoot = mkOption { @@ -286,9 +288,12 @@ in ''; }; in - lib.mapAttrs - (_: path: { root = path; }) - (haskell-parsers.findPackagesInCabalProject config.projectRoot); + lib.pipe config.projectRoot [ + haskell-parsers.findPackagesInCabalProject + (x: log.traceDebug "config.haskellProjects.${name}.packages = ${builtins.toJSON x}" x) + + (lib.mapAttrs (_: path: { root = path; })) + ]; defaultText = lib.literalMD "autodiscovered by reading `self` files."; }; devShell = mkOption {