diff --git a/CHANGELOG.md b/CHANGELOG.md index 358f342..747c621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ - #223 Make `devShell.tools` a `lazyAttrsOf` (lazy evaluation of values) - Breaking changes - #221: Switch to `buildFromSdist`, to allow using non-standard package sets (wherein `cabal-install` is otherwise built without using user's overrides) - - #253: Turn off `buildFromSdist` by default. It can now be enabled manually by setting `settings..buildFromSdist` to `true`. + - #253: Enable controlling `buildFromSdist` through `settings..buildFromSdist`. (This was turned off by default originally, but was turned on by default in #286) - #271: Change all `types.attrsOf` to `types.lazyAttrsOf`. If you use `lib.mkIf` for `attrsOf` values (not `submodule` options), use `lib.optionalAttrs` instead. This fixes #270 (`basePackages`) and improves performance. ## 0.4.0 (Aug 22, 2023) diff --git a/nix/modules/project/defaults.nix b/nix/modules/project/defaults.nix index 61aaa49..b5c7142 100644 --- a/nix/modules/project/defaults.nix +++ b/nix/modules/project/defaults.nix @@ -61,7 +61,7 @@ in If you have a `cabal.project` file (under `projectRoot`), those packages are automatically discovered. Otherwise, the top-level .cabal file is used to discover the only local package. - + haskell-flake currently supports a limited range of syntax for `cabal.project`. Specifically it requires an explicit list of package directories under the "packages" option. @@ -85,9 +85,9 @@ in default = let globalSettings = { - # We disable this by default because it causes breakage. - # See https://github.com/srid/haskell-flake/pull/253 - buildFromSdist = lib.mkDefault false; + # Make sure all files we use are included in the sdist, as a check + # for release-worthiness. + buildFromSdist = lib.mkDefault true; }; localSettings = { name, package, config, ... }: lib.optionalAttrs (package.local.toDefinedProject or false) { diff --git a/nix/modules/project/settings/default.nix b/nix/modules/project/settings/default.nix index 4da7542..1a345f6 100644 --- a/nix/modules/project/settings/default.nix +++ b/nix/modules/project/settings/default.nix @@ -50,7 +50,7 @@ in let applySettingsFor = name: mod: let - cfg = (lib.evalModules { + cfg' = (lib.evalModules { modules = [ # Settings spec ./all.nix @@ -71,13 +71,19 @@ in config = cfg; }); }).config; + cfg = traceSettings name cfg'; + # HACK: buildFromSdist must apply *last* + # cf. https://github.com/srid/haskell-flake/pull/252 + # In future, we can refactor this as part of https://github.com/srid/haskell-flake/issues/285 + impl = lib.attrsets.removeAttrs cfg.impl [ "buildFromSdist" ]; + fns = lib.attrValues impl ++ [ cfg.impl.buildFromSdist ]; in lib.pipe super.${name} ( # TODO: Do we care about the *order* of overrides? # Might be relevant for the 'custom' option. lib.concatMap (impl: impl) - (lib.attrValues (traceSettings name cfg).impl) + fns ); in lib.mapAttrs applySettingsFor project.config.settings;