Reintroduce buildFromSdist (enable it by default) (#286)

This commit is contained in:
Sridhar Ratnakumar 2024-03-29 12:05:12 -04:00 committed by GitHub
parent 474fcb0763
commit 51bcbc2719
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 7 deletions

View File

@ -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.<name>.buildFromSdist` to `true`.
- #253: Enable controlling `buildFromSdist` through `settings.<name>.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)

View File

@ -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) {

View File

@ -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;