From b879fc244cee1ecc9ee5d75b7c3b5568c399a8e1 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 09:29:12 +1200 Subject: [PATCH 01/82] Generate dummy-ghc from raw ghc source This should be fast and will avoid us having to maintain the `materialized/dummy-ghc` files. It also removes the need for materialized hadrian plans. Known drawbacks * Minimal `ghc-pkg dump` output may need to be improved: * Leaving out `build-depends` may cause solver problems. * Without `exposed-modules` other packages cannot reexported them. * Logic for `lib/supported-languages.nix` will need to be maintained manually. --- builder/hspkg-builder.nix | 2 +- compiler/ghc/default.nix | 23 +- flake.lock | 2 +- lib/call-cabal-project-to-nix.nix | 41 +++- lib/default.nix | 5 - lib/make-dummy-ghc-data.nix | 78 ------- lib/supported-languages.nix | 279 +++++++++++++++++++++++++ overlays/cache-compiler-deps.nix | 2 +- overlays/default.nix | 2 - overlays/dummy-ghc-data.nix | 10 - overlays/ghc-packages.nix | 2 +- test/cabal.project.local | 2 +- test/haskell-language-server/cabal.nix | 2 +- 13 files changed, 327 insertions(+), 123 deletions(-) delete mode 100644 lib/make-dummy-ghc-data.nix create mode 100644 lib/supported-languages.nix delete mode 100644 overlays/dummy-ghc-data.nix diff --git a/builder/hspkg-builder.nix b/builder/hspkg-builder.nix index 88ede9942d..022967fb00 100644 --- a/builder/hspkg-builder.nix +++ b/builder/hspkg-builder.nix @@ -26,7 +26,7 @@ let }."${compiler-nix-name}/${name}" or null; src = if bundledSrc != null - then ghc.configured-src + bundledSrc + then ghc.raw-src + bundledSrc else pkg.src; cabalFile = if package-description-override == null || bundledSrc != null then null else package-description-override; diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index cc4fdb3b3d..56673fa8a8 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -246,20 +246,10 @@ let then "ghc928" else "ghc962"; in - buildPackages.pinned-haskell-nix.tool compiler-nix-name "hadrian" { + buildPackages.haskell-nix.tool compiler-nix-name "hadrian" { compilerSelection = p: p.haskell.compiler; index-state = buildPackages.haskell-nix.internalHackageIndexState; # Verions of hadrian that comes with 9.6 depends on `time` - materialized = - if builtins.compareVersions ghc-version "9.4" < 0 - then ../../materialized/${compiler-nix-name}/hadrian-ghc92 - else if builtins.compareVersions ghc-version "9.6" < 0 - then ../../materialized/${compiler-nix-name}/hadrian-ghc94 - else if builtins.compareVersions ghc-version "9.8" < 0 - then ../../materialized/${compiler-nix-name}/hadrian-ghc96 - else if builtins.compareVersions ghc-version "9.9" < 0 - then ../../materialized/${compiler-nix-name}/hadrian-ghc98 - else ../../materialized/${compiler-nix-name}/hadrian-ghc99; modules = [{ # Apply the patches in a way that does not require using something # like `srcOnly`. The problem with `pkgs.srcOnly` was that it had to run @@ -633,6 +623,17 @@ stdenv.mkDerivation (rec { # We could add `configured-src` as an output of the ghc derivation, but # having it as its own derivation means it can be accessed quickly without # building GHC. + raw-src = stdenv.mkDerivation { + name = name + "-raw-src"; + inherit + version + patches + src; + installPhase = '' + cp -r . $out + ''; + phases = [ "unpackPhase" "patchPhase" "installPhase"]; + }; configured-src = stdenv.mkDerivation ({ name = name + "-configured-src"; inherit diff --git a/flake.lock b/flake.lock index 8a09c6a740..34c35f9749 100644 --- a/flake.lock +++ b/flake.lock @@ -121,7 +121,7 @@ "flake": false, "locked": { "lastModified": 1711543129, - "narHash": "sha256-MUI07CxYOng7ZwHnMCw0ugY3HmWo2p/f4r07CGV7OAM=", + "narHash": "sha256-PZvNroYZF1fnK/cAVU2iKSZdbCFdnv+hDIjJ0xvR7Z4=", "ref": "ghc-9.10", "rev": "6ecd5f2ff97af53c7334f2d8581651203a2c6b7d", "revCount": 62607, diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 18f9e48407..775fe965b5 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -288,7 +288,7 @@ let fixedProject = replaceSourceRepos rawCabalProject; - inherit (ghc) dummy-ghc-data; + ghcSrc = ghc.raw-src or ghc.buildGHC.raw-src; # Dummy `ghc` that uses the captured output dummy-ghc = evalPackages.writeTextFile { @@ -299,30 +299,30 @@ let #!${evalPackages.runtimeShell} case "$*" in --version*) - cat ${dummy-ghc-data}/ghc/version + echo "The Glorious Glasgow Haskell Compilation System, version ${ghc.version}" ;; --numeric-version*) - cat ${dummy-ghc-data}/ghc/numeric-version + echo "${ghc.version}" ;; ${pkgs.lib.optionalString (ghc.targetPrefix == "js-unknown-ghcjs-") '' --numeric-ghc-version*) - cat ${dummy-ghc-data}/ghc/numeric-ghc-version + echo "${ghc.version}" ;; --numeric-ghcjs-version*) - cat ${dummy-ghc-data}/ghc/numeric-ghcjs-version + echo "${ghc.version}" ;; ''} --supported-languages*) - cat ${dummy-ghc-data}/ghc/supported-languages + cat ${import ./supported-languages.nix { inherit pkgs evalPackages ghc; }} ;; --print-global-package-db*) echo "$out/dumby-db" ;; --info*) - cat ${dummy-ghc-data}/ghc/info + echo '[("Build platform","${pkgs.stdenv.buildPlatform.config}"),("Host platform","${pkgs.stdenv.hostPlatform.config}"),("Target platform","${pkgs.stdenv.targetPlatform.config}")]' ;; --print-libdir*) - echo ${dummy-ghc-data}/ghc/libdir + echo $out/ghc/libdir ;; *) echo "Unknown argument '$*'" >&2 @@ -342,15 +342,34 @@ let #!${evalPackages.runtimeShell} case "$*" in --version) - cat ${dummy-ghc-data}/ghc-pkg/version + echo "GHC package manager version ${ghc.version}" ;; ${pkgs.lib.optionalString (ghc.targetPrefix == "js-unknown-ghcjs-") '' --numeric-ghcjs-version) - cat ${dummy-ghc-data}/ghc-pkg/numeric-ghcjs-version + echo "${ghc.version}" ;; ''} 'dump --global -v0') - cat ${dummy-ghc-data}/ghc-pkg/dump-global + ${builtins.concatStringsSep '' + echo '---' + '' (builtins.map (name: '' + echo "name: ${name}" + if [ -f ${ghcSrc}/libraries/${name}/${name}.cabal ]; then + grep '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal + else + grep '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal.in + fi + '') (["base" "ghc-prim" "template-haskell"] + ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" < 0) "integer-gmp" + ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" >= 0) "ghc-bignum"))} + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >= 0) '' + echo '---' + echo "name: ghc" + echo "version: ${ghc.version}" + echo '---' + echo "name: system-cxx-std-lib" + echo "version: 1.0" + ''} ;; *) echo "Unknown argument '$*'. " >&2 diff --git a/lib/default.nix b/lib/default.nix index 88d0ab813c..1e46be70e2 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -570,11 +570,6 @@ in { inherit (pkgs.buildPackages.buildPackages) lib runCommand; }; - makeDummyGhcData = import ./make-dummy-ghc-data.nix { - inherit pkgs; - inherit (pkgs.buildPackages.buildPackages) runCommand; - }; - # Here we try to figure out which qemu to use based on the host platform. # This guess can be overridden by passing qemuSuffix qemuByHostPlatform = hostPlatform: diff --git a/lib/make-dummy-ghc-data.nix b/lib/make-dummy-ghc-data.nix deleted file mode 100644 index 0ddd4ef44c..0000000000 --- a/lib/make-dummy-ghc-data.nix +++ /dev/null @@ -1,78 +0,0 @@ -# The use of the actual GHC can cause significant problems: -# * For hydra to assemble a list of jobs from `components.tests` it must -# first have GHC that will be used. If a patch has been applied to the -# GHC to be used it must be rebuilt before the list of jobs can be assembled. -# If a lot of different GHCs are being tests that can be a lot of work all -# happening in the eval stage where little feedback is available. -# * Once the jobs are running the compilation of the GHC needed (the eval -# stage already must have done it, but the outputs there are apparently -# not added to the cache) happens inside the IFD part of cabalProject. -# This causes a very large amount of work to be done in the IFD and our -# understanding is that this can cause problems on nix and/or hydra. -# * When using cabalProject we cannot examine the properties of the project without -# building or downloading the GHC (less of an issue as we would normally need -# it soon anyway). -# -# The solution here is to capture the GHC outputs that `cabal v2-configure` -# requests and materialize it so that the real GHC is only needed -# when `checkMaterialization` is set. -{ pkgs, runCommand }: -materialized-dir: -let - inherit (pkgs.haskell-nix) checkMaterialization; - makeDummyGhcData = ghc: ghc // { - dummy-ghc-data = - let - materialized = materialized-dir + "/dummy-ghc/${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}" - + pkgs.lib.optionalString (builtins.compareVersions ghc.version "8.10" < 0 && ghc.targetPrefix == "" && builtins.compareVersions pkgs.lib.version "22.05" < 0) "-old"; - in pkgs.haskell-nix.materialize ({ - sha256 = null; - sha256Arg = "sha256"; - materialized = if __pathExists materialized - then materialized - else __trace "WARNING: No materialized dummy-ghc-data. mkdir ${toString materialized}" - null; - reasonNotSafe = null; - } // pkgs.lib.optionalAttrs (checkMaterialization != null) { - inherit checkMaterialization; - }) ( - runCommand ("dummy-data-" + ghc.name) { - nativeBuildInputs = [ ghc ]; - } '' - mkdir -p $out/ghc - mkdir -p $out/ghc-pkg - ${ghc.targetPrefix}ghc --version > $out/ghc/version - ${ghc.targetPrefix}ghc --numeric-version > $out/ghc/numeric-version - ${ghc.targetPrefix}ghc --info | grep -v /nix/store > $out/ghc/info - ${ghc.targetPrefix}ghc --supported-languages > $out/ghc/supported-languages - ${ghc.targetPrefix}ghc-pkg --version > $out/ghc-pkg/version - ${pkgs.lib.optionalString (ghc.targetPrefix == "js-unknown-ghcjs-") '' - ${ghc.targetPrefix}ghc --numeric-ghc-version > $out/ghc/numeric-ghc-version - ${ghc.targetPrefix}ghc --numeric-ghcjs-version > $out/ghc/numeric-ghcjs-version - ${ghc.targetPrefix}ghc-pkg --numeric-ghcjs-version > $out/ghc-pkg/numeric-ghcjs-version - ''} - # The order of the `ghc-pkg dump` output seems to be non - # deterministic so we need to sort it so that it is always - # the same. - # Sort the output by spliting it on the --- separator line, - # sorting it, adding the --- separators back and removing the - # last line (the trailing ---) - ${ghc.targetPrefix}ghc-pkg dump --global -v0 \ - | grep -v /nix/store \ - | grep -v '^abi:' \ - | tr '\n' '\r' \ - | sed -e 's/\r\r*/\r/g' \ - | sed -e 's/\r$//g' \ - | sed -e 's/\r---\r/\n/g' \ - | sort \ - | sed -e 's/$/\r---/g' \ - | tr '\r' '\n' \ - | sed -e '$ d' \ - > $out/ghc-pkg/dump-global - ''); - } // pkgs.lib.optionalAttrs (ghc ? dwarf) { - dwarf = makeDummyGhcData ghc.dwarf; - } // pkgs.lib.optionalAttrs (ghc ? smallAddressSpace) { - smallAddressSpace = makeDummyGhcData ghc.smallAddressSpace; - }; -in makeDummyGhcData diff --git a/lib/supported-languages.nix b/lib/supported-languages.nix new file mode 100644 index 0000000000..4fa2d51d7b --- /dev/null +++ b/lib/supported-languages.nix @@ -0,0 +1,279 @@ +{pkgs, evalPackages, ghc}: +evalPackages.writeTextFile { + name = "supported-languages"; + text = '' +Haskell98 +Haskell2010 +GHC2021 +Unsafe +Trustworthy +Safe +AllowAmbiguousTypes +NoAllowAmbiguousTypes +AlternativeLayoutRule +NoAlternativeLayoutRule +AlternativeLayoutRuleTransitional +NoAlternativeLayoutRuleTransitional +Arrows +NoArrows +AutoDeriveTypeable +NoAutoDeriveTypeable +BangPatterns +NoBangPatterns +BinaryLiterals +NoBinaryLiterals +CApiFFI +NoCApiFFI +CPP +NoCPP +CUSKs +NoCUSKs +ConstrainedClassMethods +NoConstrainedClassMethods +ConstraintKinds +NoConstraintKinds +DataKinds +NoDataKinds +DatatypeContexts +NoDatatypeContexts +DefaultSignatures +NoDefaultSignatures +DeriveAnyClass +NoDeriveAnyClass +DeriveDataTypeable +NoDeriveDataTypeable +DeriveFoldable +NoDeriveFoldable +DeriveFunctor +NoDeriveFunctor +DeriveGeneric +NoDeriveGeneric +DeriveLift +NoDeriveLift +DeriveTraversable +NoDeriveTraversable +DerivingStrategies +NoDerivingStrategies +DerivingVia +NoDerivingVia +DisambiguateRecordFields +NoDisambiguateRecordFields +DoAndIfThenElse +NoDoAndIfThenElse +BlockArguments +NoBlockArguments +DoRec +NoDoRec +DuplicateRecordFields +NoDuplicateRecordFields +FieldSelectors +NoFieldSelectors +EmptyCase +NoEmptyCase +EmptyDataDecls +NoEmptyDataDecls +EmptyDataDeriving +NoEmptyDataDeriving +ExistentialQuantification +NoExistentialQuantification +ExplicitForAll +NoExplicitForAll +ExplicitNamespaces +NoExplicitNamespaces +ExtendedDefaultRules +NoExtendedDefaultRules +ExtendedLiterals +NoExtendedLiterals +FlexibleContexts +NoFlexibleContexts +FlexibleInstances +NoFlexibleInstances +ForeignFunctionInterface +NoForeignFunctionInterface +FunctionalDependencies +NoFunctionalDependencies +GADTSyntax +NoGADTSyntax +GADTs +NoGADTs +GHCForeignImportPrim +NoGHCForeignImportPrim +GeneralizedNewtypeDeriving +NoGeneralizedNewtypeDeriving +GeneralisedNewtypeDeriving +NoGeneralisedNewtypeDeriving +ImplicitParams +NoImplicitParams +ImplicitPrelude +NoImplicitPrelude +ImportQualifiedPost +NoImportQualifiedPost +ImpredicativeTypes +NoImpredicativeTypes +IncoherentInstances +NoIncoherentInstances +TypeFamilyDependencies +NoTypeFamilyDependencies +InstanceSigs +NoInstanceSigs +ApplicativeDo +NoApplicativeDo +InterruptibleFFI +NoInterruptibleFFI +NoJavaScriptFFI +KindSignatures +NoKindSignatures +LambdaCase +NoLambdaCase +LexicalNegation +NoLexicalNegation +LiberalTypeSynonyms +NoLiberalTypeSynonyms +LinearTypes +NoLinearTypes +MagicHash +NoMagicHash +MonadComprehensions +NoMonadComprehensions +MonoLocalBinds +NoMonoLocalBinds +DeepSubsumption +NoDeepSubsumption +MonomorphismRestriction +NoMonomorphismRestriction +MultiParamTypeClasses +NoMultiParamTypeClasses +MultiWayIf +NoMultiWayIf +NumericUnderscores +NoNumericUnderscores +NPlusKPatterns +NoNPlusKPatterns +NamedFieldPuns +NoNamedFieldPuns +NamedWildCards +NoNamedWildCards +NegativeLiterals +NoNegativeLiterals +HexFloatLiterals +NoHexFloatLiterals +NondecreasingIndentation +NoNondecreasingIndentation +NullaryTypeClasses +NoNullaryTypeClasses +NumDecimals +NoNumDecimals +OverlappingInstances +NoOverlappingInstances +OverloadedLabels +NoOverloadedLabels +OverloadedLists +NoOverloadedLists +OverloadedStrings +NoOverloadedStrings +PackageImports +NoPackageImports +ParallelArrays +NoParallelArrays +ParallelListComp +NoParallelListComp +PartialTypeSignatures +NoPartialTypeSignatures +PatternGuards +NoPatternGuards +PatternSignatures +NoPatternSignatures +PatternSynonyms +NoPatternSynonyms +PolyKinds +NoPolyKinds +PolymorphicComponents +NoPolymorphicComponents +QuantifiedConstraints +NoQuantifiedConstraints +PostfixOperators +NoPostfixOperators +QuasiQuotes +NoQuasiQuotes +QualifiedDo +NoQualifiedDo +Rank2Types +NoRank2Types +RankNTypes +NoRankNTypes +RebindableSyntax +NoRebindableSyntax +OverloadedRecordDot +NoOverloadedRecordDot +OverloadedRecordUpdate +NoOverloadedRecordUpdate +RecordPuns +NoRecordPuns +RecordWildCards +NoRecordWildCards +RecursiveDo +NoRecursiveDo +RelaxedLayout +NoRelaxedLayout +RelaxedPolyRec +NoRelaxedPolyRec +RoleAnnotations +NoRoleAnnotations +ScopedTypeVariables +NoScopedTypeVariables +StandaloneDeriving +NoStandaloneDeriving +StarIsType +NoStarIsType +StaticPointers +NoStaticPointers +Strict +NoStrict +StrictData +NoStrictData +TemplateHaskell +NoTemplateHaskell +TemplateHaskellQuotes +NoTemplateHaskellQuotes +StandaloneKindSignatures +NoStandaloneKindSignatures +TraditionalRecordSyntax +NoTraditionalRecordSyntax +TransformListComp +NoTransformListComp +TupleSections +NoTupleSections +TypeAbstractions +NoTypeAbstractions +TypeApplications +NoTypeApplications +TypeData +NoTypeData +TypeInType +NoTypeInType +TypeFamilies +NoTypeFamilies +TypeOperators +NoTypeOperators +TypeSynonymInstances +NoTypeSynonymInstances +UnboxedTuples +NoUnboxedTuples +UnboxedSums +NoUnboxedSums +UndecidableInstances +NoUndecidableInstances +UndecidableSuperClasses +NoUndecidableSuperClasses +UnicodeSyntax +NoUnicodeSyntax +UnliftedDatatypes +NoUnliftedDatatypes +UnliftedFFITypes +NoUnliftedFFITypes +UnliftedNewtypes +NoUnliftedNewtypes +ViewPatterns +NoViewPatterns +''; +} diff --git a/overlays/cache-compiler-deps.nix b/overlays/cache-compiler-deps.nix index 62a4529625..b74d6398aa 100644 --- a/overlays/cache-compiler-deps.nix +++ b/overlays/cache-compiler-deps.nix @@ -4,7 +4,7 @@ final: prev: { }; haskell = prev.haskell // { compiler = __mapAttrs (name: ghc: final.haskell-nix.haskellLib.makeCompilerDeps ghc // { - inherit (final.haskell-nix.compiler.${name}) configured-src; + inherit (final.haskell-nix.compiler.${name}) raw-src configured-src; }) prev.haskell.compiler; }; } diff --git a/overlays/default.nix b/overlays/default.nix index 281194a58c..c21acbd84b 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -85,7 +85,6 @@ let ghcjs = import ./ghcjs.nix; cabalPkgConfig = import ./cabal-pkg-config.nix; cacheCompilerDeps = import ./cache-compiler-deps.nix; - dummy-ghc-data = import ./dummy-ghc-data.nix; fetch-source = import ./fetch-source.nix; }; @@ -125,7 +124,6 @@ let hydra # Restore nixpkgs haskell and haskellPackages (_: prev: { inherit (prev.haskell-nix-prev) haskell haskellPackages; }) - dummy-ghc-data cacheCompilerDeps fetch-source ]; diff --git a/overlays/dummy-ghc-data.nix b/overlays/dummy-ghc-data.nix deleted file mode 100644 index e727c1993b..0000000000 --- a/overlays/dummy-ghc-data.nix +++ /dev/null @@ -1,10 +0,0 @@ -final: prev: { - haskell-nix = prev.haskell-nix // { - compiler = __mapAttrs (_name: - final.haskell-nix.haskellLib.makeDummyGhcData ../materialized) prev.haskell-nix.compiler; - }; - haskell = prev.haskell // { - compiler = __mapAttrs (_name: - final.haskell-nix.haskellLib.makeDummyGhcData ../materialized/nixpkgs) prev.haskell.compiler; - }; -} diff --git a/overlays/ghc-packages.nix b/overlays/ghc-packages.nix index 4087f56a61..55296e9000 100644 --- a/overlays/ghc-packages.nix +++ b/overlays/ghc-packages.nix @@ -181,7 +181,7 @@ in rec { inherit subDir; includeSiblings = true; } - else "${ghc.passthru.configured-src}/${subDir}"; + else "${ghc.passthru.raw-src}/${subDir}"; nix = callCabal2Nix ghcName "${ghcName}-${pkgName}" src; }) (ghc-extra-pkgs ghc.version)) final.buildPackages.haskell-nix.compiler; diff --git a/test/cabal.project.local b/test/cabal.project.local index 6ed377e774..b260958c5a 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -18,7 +18,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-h/vbKTUdGVdkt2ogJer2d+gRuHkayiblQ7oFRqpj14c= + --sha256: sha256-ddxP+nxBsM0SLvaiiB80k5DpX0PsKJq9VXhESPHKAF8= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/91f4ce9bea0e7f739b7495647c3f72a308ed1c6f diff --git a/test/haskell-language-server/cabal.nix b/test/haskell-language-server/cabal.nix index 7c9429c0c5..69e800a188 100644 --- a/test/haskell-language-server/cabal.nix +++ b/test/haskell-language-server/cabal.nix @@ -16,7 +16,7 @@ let f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-Bkn2Etb0JVmb7tM7jxuIoYLFnSp7acqraEYVq0I5oUM= + --sha256: sha256-ddxP+nxBsM0SLvaiiB80k5DpX0PsKJq9VXhESPHKAF8= if impl(ghc < 9.7) active-repositories: hackage.haskell.org From b47022c119d422724df8837243a4f86572af520d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 10:00:34 +1200 Subject: [PATCH 02/82] Add ghci --- lib/call-cabal-project-to-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 775fe965b5..2864a15f3e 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -359,7 +359,7 @@ let else grep '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal.in fi - '') (["base" "ghc-prim" "template-haskell"] + '') (["base" "ghc-prim" "ghci" "template-haskell"] ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" < 0) "integer-gmp" ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" >= 0) "ghc-bignum"))} ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >= 0) '' From 5148a8325844b42a1b3963c789db2a83b6c85337 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 10:23:03 +1200 Subject: [PATCH 03/82] Add ghci --- lib/call-cabal-project-to-nix.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 2864a15f3e..a232282e25 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -359,7 +359,7 @@ let else grep '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal.in fi - '') (["base" "ghc-prim" "ghci" "template-haskell"] + '') (["base" "ghc-prim" "template-haskell"] ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" < 0) "integer-gmp" ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" >= 0) "ghc-bignum"))} ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >= 0) '' @@ -367,6 +367,9 @@ let echo "name: ghc" echo "version: ${ghc.version}" echo '---' + echo "name: ghci" + echo "version: ${ghc.version}" + echo '---' echo "name: system-cxx-std-lib" echo "version: 1.0" ''} From d3b0b83d4a284654629ac88a779a486f6c2610b5 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 14:03:33 +1200 Subject: [PATCH 04/82] Fix reinstallable lib ghc --- overlays/ghc-packages.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/overlays/ghc-packages.nix b/overlays/ghc-packages.nix index 55296e9000..9bc219a69f 100644 --- a/overlays/ghc-packages.nix +++ b/overlays/ghc-packages.nix @@ -181,6 +181,8 @@ in rec { inherit subDir; includeSiblings = true; } + else if builtins.elem subDir ["libraries/ghc-heap" "utils/remote-iserv" "libraries/ghci" "libraries/template-haskell" "utils/iserv" "libraries/ghc-prim"] + then "${ghc.passthru.configured-src}/${subDir}" else "${ghc.passthru.raw-src}/${subDir}"; nix = callCabal2Nix ghcName "${ghcName}-${pkgName}" src; }) (ghc-extra-pkgs ghc.version)) From 4bde92327f908d8b4fd80ab4f6ef1c8ef0718aad Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 14:03:53 +1200 Subject: [PATCH 05/82] ifdLevel 1 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 267ed37ca8..6718eb01d2 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 3 +{ ifdLevel ? 1 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From c7e3d0ff9f2d6ea0ec0fad6f9a67665d70ab75a2 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 14:10:35 +1200 Subject: [PATCH 06/82] ifdLevel 2 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 6718eb01d2..3894974a01 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 1 +{ ifdLevel ? 2 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From eca98b3f479ac78581b55a1a9d8f7a510253e04f Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 16:19:30 +1200 Subject: [PATCH 07/82] Add more packages --- lib/call-cabal-project-to-nix.nix | 9 +++++++-- overlays/ghc-packages.nix | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index a232282e25..e8ffd3254e 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -359,14 +359,19 @@ let else grep '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal.in fi - '') (["base" "ghc-prim" "template-haskell"] - ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" < 0) "integer-gmp" + '') (["base" "ghc-prim" "template-haskell" "integer-gmp"] ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" >= 0) "ghc-bignum"))} ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >= 0) '' echo '---' echo "name: ghc" echo "version: ${ghc.version}" echo '---' + echo "name: ghc-boot" + echo "version: ${ghc.version}" + echo '---' + echo "name: ghc-boot-th" + echo "version: ${ghc.version}" + echo '---' echo "name: ghci" echo "version: ${ghc.version}" echo '---' diff --git a/overlays/ghc-packages.nix b/overlays/ghc-packages.nix index 9bc219a69f..97592fc8a7 100644 --- a/overlays/ghc-packages.nix +++ b/overlays/ghc-packages.nix @@ -181,7 +181,7 @@ in rec { inherit subDir; includeSiblings = true; } - else if builtins.elem subDir ["libraries/ghc-heap" "utils/remote-iserv" "libraries/ghci" "libraries/template-haskell" "utils/iserv" "libraries/ghc-prim"] + else if builtins.elem subDir ["libraries/ghc-heap" "utils/remote-iserv" "libraries/ghci" "libraries/template-haskell" "utils/iserv" "libraries/ghc-prim" "libraries/libiserv"] then "${ghc.passthru.configured-src}/${subDir}" else "${ghc.passthru.raw-src}/${subDir}"; nix = callCabal2Nix ghcName "${ghcName}-${pkgName}" src; From a2824224d1d1883625616d44e6344bfba3535cc4 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 17:16:53 +1200 Subject: [PATCH 08/82] Fix for ghc 8.10 --- lib/call-cabal-project-to-nix.nix | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index e8ffd3254e..36975d2320 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -361,19 +361,19 @@ let fi '') (["base" "ghc-prim" "template-haskell" "integer-gmp"] ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" >= 0) "ghc-bignum"))} + echo '---' + echo "name: ghc" + echo "version: ${ghc.version}" + echo '---' + echo "name: ghc-boot" + echo "version: ${ghc.version}" + echo '---' + echo "name: ghc-boot-th" + echo "version: ${ghc.version}" + echo '---' + echo "name: ghci" + echo "version: ${ghc.version}" ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >= 0) '' - echo '---' - echo "name: ghc" - echo "version: ${ghc.version}" - echo '---' - echo "name: ghc-boot" - echo "version: ${ghc.version}" - echo '---' - echo "name: ghc-boot-th" - echo "version: ${ghc.version}" - echo '---' - echo "name: ghci" - echo "version: ${ghc.version}" echo '---' echo "name: system-cxx-std-lib" echo "version: 1.0" From d2ccd7aef331c910ef35ae62fe0ffdbc0b063244 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 18:05:33 +1200 Subject: [PATCH 09/82] Fix utils/iserv-proxy source for older ghc --- overlays/ghc-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlays/ghc-packages.nix b/overlays/ghc-packages.nix index 97592fc8a7..de359ec565 100644 --- a/overlays/ghc-packages.nix +++ b/overlays/ghc-packages.nix @@ -181,7 +181,7 @@ in rec { inherit subDir; includeSiblings = true; } - else if builtins.elem subDir ["libraries/ghc-heap" "utils/remote-iserv" "libraries/ghci" "libraries/template-haskell" "utils/iserv" "libraries/ghc-prim" "libraries/libiserv"] + else if builtins.elem subDir ["libraries/ghc-heap" "utils/remote-iserv" "libraries/ghci" "libraries/template-haskell" "utils/iserv" "libraries/ghc-prim" "libraries/libiserv" "utils/iserv-proxy"] then "${ghc.passthru.configured-src}/${subDir}" else "${ghc.passthru.raw-src}/${subDir}"; nix = callCabal2Nix ghcName "${ghcName}-${pkgName}" src; From 7ede55e31e1d93091e7ea145705a18c3dd69819a Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 12 Apr 2024 22:21:17 +1200 Subject: [PATCH 10/82] ifdLevel 3 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 3894974a01..267ed37ca8 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 2 +{ ifdLevel ? 3 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From f96b03df1f5007af02fb4b91fca7edb75345e81c Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 16 Apr 2024 17:38:46 +1200 Subject: [PATCH 11/82] Include depends in dummy-ghc --- lib/call-cabal-project-to-nix.nix | 127 +++++++++++++++++++++++------- 1 file changed, 100 insertions(+), 27 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 36975d2320..7d64aec610 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -333,6 +333,54 @@ let ''; }; + ghc-pkgs = { + Cabal.depends = ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "text" "time" "transformers" "unix"]; + Cabal-syntax.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers" "unix"]; + array.depends = ["base"]; + base.depends = ["ghc-bignum" "ghc-prim" "rts"]; + binary.depends = ["array" "base" "bytestring" "containers"]; + bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; + containers.depends = ["array" "base" "deepseq" "template-haskell"]; + deepseq.depends = ["array" "base" "ghc-prim"]; + directory.depends = ["base" "filepath" "time" "unix"]; + exceptions.depends = ["base" "mtl" "stm" "template-haskell" "transformers"]; + filepath.depends = ["base" "bytestring" "deepseq" "exceptions" "template-haskell"]; + ghc.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "exceptions" "filepath" "ghc-boot" "ghc-heap" "ghci" "hpc" "process" "semaphore-compat" "stm" "template-haskell" "time" "transformers" "unix"]; + ghc-bignum.depends = ["ghc-prim"]; + ghc-boot.depends = ["base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "ghc-boot-th" "unix"]; + ghc-boot-th.depends = ["base"]; + ghc-compact.depends = ["base" "bytestring" "ghc-prim"]; + ghc-heap.depends = ["base" "containers" "ghc-prim" "rts"]; + ghc-prim.depends = ["rts"]; + ghci.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "filepath" "ghc-boot" "ghc-heap" "ghc-prim" "rts" "template-haskell" "transformers" "unix"]; + haskeline.depends = ["base" "bytestring" "containers" "directory" "exceptions" "filepath" "process" "stm" "terminfo" "transformers" "unix"]; + hpc.depends = ["base" "containers" "deepseq" "directory" "filepath" "time"]; + integer-gmp.depends = ["base" "ghc-bignum" "ghc-prim"]; + mtl.depends = ["base" "transformers"]; + parsec.depends = ["base" "bytestring" "mtl" "text"]; + pretty.depends = ["base" "deepseq" "ghc-prim"]; + process.depends = ["base" "deepseq" "directory" "filepath" "unix"]; + rts.depends = []; + semaphore-compat.depends = ["base" "exceptions" "unix"]; + stm.depends = ["array" "base"]; + template-haskell.depends = ["base" "ghc-boot-th" "ghc-prim" "pretty"]; + terminfo.depends = ["base"]; + text.depends = ["array" "base" "binary" "bytestring" "deepseq" "ghc-prim" "template-haskell"]; + time.depends = ["base" "deepseq"]; + transformers.depends = ["base"]; + unix.depends = ["base" "bytestring" "filepath" "time"]; + xhtml.depends = ["base"]; + + ghc.version = ghc.version; + ghc-boot.version = ghc.version; + ghc-boot-th.version = ghc.version; + ghc-heap.version = ghc.version; + ghci.version = ghc.version; + } // pkgs.lib.optionalAttrs (builtins.compareVersions ghc.version "9.2" >= 0) { + system-cxx-std-lib.depends = []; + system-cxx-std-lib.version = "1.0"; + }; + # Dummy `ghc-pkg` that uses the captured output dummy-ghc-pkg = evalPackages.writeTextFile { name = "dummy-pkg-" + ghc.name; @@ -350,34 +398,59 @@ let ;; ''} 'dump --global -v0') - ${builtins.concatStringsSep '' - echo '---' - '' (builtins.map (name: '' - echo "name: ${name}" - if [ -f ${ghcSrc}/libraries/${name}/${name}.cabal ]; then - grep '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal - else - grep '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal.in + PKGS="" + ${pkgs.lib.concatStrings + (builtins.map (name: let varname = x: builtins.replaceStrings ["-"] ["_"] x; in '' + DEPS_${varname name}="${builtins.concatStringsSep " " ghc-pkgs.${name}.depends}" + ${if ghc-pkgs.${name} ? version + then '' + VER_${varname name}="${ghc-pkgs.${name}.version}" + PKGS+=" ${name}" + LAST_PKG="${name}" + '' + else '' + if [ -f ${ghcSrc}/libraries/${name}/${name}.cabal ]; then + VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') + PKGS+=" ${name}" + LAST_PKG="${name}" + elif [ -f ${ghcSrc}/libraries/Cabal/${name}/${name}.cabal ]; then + VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/Cabal/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') + PKGS+=" ${name}" + elif [ -f ${ghcSrc}/libraries/${name}/${name}/${name}.cabal ]; then + VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/${name}/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') + PKGS+=" ${name}" + elif [ -f ${ghcSrc}/${name}/${name}.cabal ]; then + VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') + PKGS+=" ${name}" + elif [ -f ${ghcSrc}/${name}/${name}.cabal.in ]; then + VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/${name}/${name}.cabal.in | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') + PKGS+=" ${name}" + elif [ -f ${ghcSrc}/libraries/${name}/${name}.cabal.in ]; then + VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal.in | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') + PKGS+=" ${name}" + LAST_PKG="${name}" + fi + '' + } + '') (builtins.attrNames ghc-pkgs)) + } + for pkg in $PKGS; do + varname="$(echo $pkg | tr "-" "_")" + ver="VER_$varname" + deps="DEPS_$varname" + echo "name: $pkg" + echo "version: ''${!ver}" + echo "depends:" + for dep in ''${!deps}; do + ver_dep="VER_$(echo $dep | tr "-" "_")" + if [[ "''${!ver_dep}" != "" ]]; then + echo " $dep-''${!ver_dep}" fi - '') (["base" "ghc-prim" "template-haskell" "integer-gmp"] - ++ pkgs.lib.optional (builtins.compareVersions ghc.version "9.0" >= 0) "ghc-bignum"))} - echo '---' - echo "name: ghc" - echo "version: ${ghc.version}" - echo '---' - echo "name: ghc-boot" - echo "version: ${ghc.version}" - echo '---' - echo "name: ghc-boot-th" - echo "version: ${ghc.version}" - echo '---' - echo "name: ghci" - echo "version: ${ghc.version}" - ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >= 0) '' - echo '---' - echo "name: system-cxx-std-lib" - echo "version: 1.0" - ''} + done + if [[ "$pkg" != "$LAST_PKG" ]]; then + echo '---' + fi + done ;; *) echo "Unknown argument '$*'. " >&2 From 952e0e5b93d574677326a59f822cdad9f52be584 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 16 Apr 2024 22:54:45 +1200 Subject: [PATCH 12/82] Fix ghcjs --- overlays/bootstrap.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index 1307108768..bcb44291b3 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -1163,6 +1163,7 @@ in { isHaskellNixCompiler = true; enableShared = false; inherit (booted-ghcjs) configured-src bundled-ghcjs project; + raw-src = booted-ghcjs.configured-src; inherit booted-ghcjs buildGHC; extraConfigureFlags = [ "--ghcjs" @@ -1197,6 +1198,7 @@ in { isHaskellNixCompiler = true; enableShared = false; inherit (booted-ghcjs) configured-src bundled-ghcjs project; + raw-src = booted-ghcjs.configured-src; inherit booted-ghcjs buildGHC; extraConfigureFlags = [ "--ghcjs" @@ -1231,6 +1233,7 @@ in { isHaskellNixCompiler = true; enableShared = false; inherit (booted-ghcjs) configured-src bundled-ghcjs project; + raw-src = booted-ghcjs.configured-src; inherit booted-ghcjs buildGHC; extraConfigureFlags = [ "--ghcjs" @@ -1265,6 +1268,7 @@ in { isHaskellNixCompiler = true; enableShared = false; inherit (booted-ghcjs) configured-src bundled-ghcjs project; + raw-src = booted-ghcjs.configured-src; inherit booted-ghcjs buildGHC; extraConfigureFlags = [ "--ghcjs" @@ -1299,6 +1303,7 @@ in { isHaskellNixCompiler = true; enableShared = false; inherit (booted-ghcjs) configured-src bundled-ghcjs project; + raw-src = booted-ghcjs.configured-src; inherit booted-ghcjs buildGHC; extraConfigureFlags = [ "--ghcjs" From f9ab8aa744ae13ec6430901f679f48541c1b2506 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 16 Apr 2024 22:55:13 +1200 Subject: [PATCH 13/82] ifdLevel 0 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 267ed37ca8..75286cd955 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 3 +{ ifdLevel ? 0 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From 774ccdb43a136928bba953872ed6ee97bc5f326d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 16 Apr 2024 23:49:31 +1200 Subject: [PATCH 14/82] Avoid eval time dependency on ghc.generated --- lib/call-cabal-project-to-nix.nix | 4 ++-- overlays/ghc-packages.nix | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 7d64aec610..44f381d012 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -334,8 +334,8 @@ let }; ghc-pkgs = { - Cabal.depends = ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "text" "time" "transformers" "unix"]; - Cabal-syntax.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers" "unix"]; + # Cabal.depends = ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "text" "time" "transformers" "unix"]; + # Cabal-syntax.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers" "unix"]; array.depends = ["base"]; base.depends = ["ghc-bignum" "ghc-prim" "rts"]; binary.depends = ["array" "base" "bytestring" "containers"]; diff --git a/overlays/ghc-packages.nix b/overlays/ghc-packages.nix index de359ec565..2160ec5934 100644 --- a/overlays/ghc-packages.nix +++ b/overlays/ghc-packages.nix @@ -2,7 +2,7 @@ final: _prev: let callCabal2Nix = _compiler-nix-name: name: src: final.buildPackages.stdenv.mkDerivation { name = "${name}-package.nix"; - inherit src; + src = src.srcForCabal2Nix or src; nativeBuildInputs = [ # It is not safe to check the nix-tools materialization here # as we would need to run this code to do so leading to @@ -151,7 +151,7 @@ in rec { mkdir $out lndir -silent ${ghc.passthru.configured-src}/${subDir} $out lndir -silent ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC $out/GHC - '') + '') // { srcForCabal2Nix = ghc.passthru.configured-src + "/${subDir}"; } else if subDir == "compiler" then final.haskell-nix.haskellLib.cleanSourceWith { src = nix24srcFix (final.buildPackages.runCommand "ghc-src" { nativeBuildInputs = [final.buildPackages.xorg.lndir]; } '' @@ -180,7 +180,7 @@ in rec { ''); inherit subDir; includeSiblings = true; - } + } // { srcForCabal2Nix = ghc.passthru.configured-src + "/${subDir}"; } else if builtins.elem subDir ["libraries/ghc-heap" "utils/remote-iserv" "libraries/ghci" "libraries/template-haskell" "utils/iserv" "libraries/ghc-prim" "libraries/libiserv" "utils/iserv-proxy"] then "${ghc.passthru.configured-src}/${subDir}" else "${ghc.passthru.raw-src}/${subDir}"; From 61e3ecadecdba8095d8cc523c6606e6fc9ef4034 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 01:06:00 +1200 Subject: [PATCH 15/82] ifdLevel 1 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 75286cd955..6718eb01d2 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 0 +{ ifdLevel ? 1 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From cca7aa038d3fed3ebb98e8221c54cd4aa4e27158 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 01:24:14 +1200 Subject: [PATCH 16/82] ifdLevel 2 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 6718eb01d2..3894974a01 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 1 +{ ifdLevel ? 2 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From f01635a22016b6f4478f10bca2955e99a6583218 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 01:42:12 +1200 Subject: [PATCH 17/82] ifdLevel 3 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 3894974a01..267ed37ca8 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 2 +{ ifdLevel ? 3 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From 9647a0efc847ee59243a6d4de71363ce00a1d955 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 15:26:49 +1200 Subject: [PATCH 18/82] Fix `relude` and `semaphore-compat` --- lib/call-cabal-project-to-nix.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 44f381d012..6b417645b1 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -339,8 +339,8 @@ let array.depends = ["base"]; base.depends = ["ghc-bignum" "ghc-prim" "rts"]; binary.depends = ["array" "base" "bytestring" "containers"]; - bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; - containers.depends = ["array" "base" "deepseq" "template-haskell"]; + # bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; + # containers.depends = ["array" "base" "deepseq" "template-haskell"]; deepseq.depends = ["array" "base" "ghc-prim"]; directory.depends = ["base" "filepath" "time" "unix"]; exceptions.depends = ["base" "mtl" "stm" "template-haskell" "transformers"]; @@ -357,7 +357,7 @@ let hpc.depends = ["base" "containers" "deepseq" "directory" "filepath" "time"]; integer-gmp.depends = ["base" "ghc-bignum" "ghc-prim"]; mtl.depends = ["base" "transformers"]; - parsec.depends = ["base" "bytestring" "mtl" "text"]; + # parsec.depends = ["base" "bytestring" "mtl" "text"]; pretty.depends = ["base" "deepseq" "ghc-prim"]; process.depends = ["base" "deepseq" "directory" "filepath" "unix"]; rts.depends = []; @@ -365,7 +365,7 @@ let stm.depends = ["array" "base"]; template-haskell.depends = ["base" "ghc-boot-th" "ghc-prim" "pretty"]; terminfo.depends = ["base"]; - text.depends = ["array" "base" "binary" "bytestring" "deepseq" "ghc-prim" "template-haskell"]; + # text.depends = ["array" "base" "binary" "bytestring" "deepseq" "ghc-prim" "template-haskell"]; time.depends = ["base" "deepseq"]; transformers.depends = ["base"]; unix.depends = ["base" "bytestring" "filepath" "time"]; @@ -410,7 +410,7 @@ let '' else '' if [ -f ${ghcSrc}/libraries/${name}/${name}.cabal ]; then - VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') + VER_${varname name}=$(cat ${ghcSrc}/libraries/${name}/${name}.cabal | tr "\n" "\r" | sed -E -e 's/.*\r[Vv]ersion:( |\r|\t)*([0-9.]*).*/\2/') PKGS+=" ${name}" LAST_PKG="${name}" elif [ -f ${ghcSrc}/libraries/Cabal/${name}/${name}.cabal ]; then From 13219867433355cd63356746a9ee8468b340e78a Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 15:46:47 +1200 Subject: [PATCH 19/82] Fix for ghc 9.10 --- lib/call-cabal-project-to-nix.nix | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 6b417645b1..830f613aac 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -334,29 +334,41 @@ let }; ghc-pkgs = { + # GHC 9.8 # Cabal.depends = ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "text" "time" "transformers" "unix"]; # Cabal-syntax.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers" "unix"]; + # GHC 9.10 + # Cabal.depends = ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "time" "transformers" "unix"]; + # Cabal-syntax.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers"]; array.depends = ["base"]; - base.depends = ["ghc-bignum" "ghc-prim" "rts"]; + base.depends = + if builtins.compareVersions ghc.version "9.10" >= 0 + then ["ghc-internal" "ghc-prim"] + else ["ghc-bignum" "ghc-prim" "rts"]; binary.depends = ["array" "base" "bytestring" "containers"]; # bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; # containers.depends = ["array" "base" "deepseq" "template-haskell"]; deepseq.depends = ["array" "base" "ghc-prim"]; - directory.depends = ["base" "filepath" "time" "unix"]; + directory.depends = ["base" "filepath" "os-string" "time" "unix"]; exceptions.depends = ["base" "mtl" "stm" "template-haskell" "transformers"]; - filepath.depends = ["base" "bytestring" "deepseq" "exceptions" "template-haskell"]; + filepath.depends = ["base" "bytestring" "deepseq" "exceptions" "os-string" "template-haskell"]; ghc.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "exceptions" "filepath" "ghc-boot" "ghc-heap" "ghci" "hpc" "process" "semaphore-compat" "stm" "template-haskell" "time" "transformers" "unix"]; ghc-bignum.depends = ["ghc-prim"]; - ghc-boot.depends = ["base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "ghc-boot-th" "unix"]; + ghc-boot.depends = ["base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "ghc-boot-th" "ghc-platform" "unix"]; ghc-boot-th.depends = ["base"]; ghc-compact.depends = ["base" "bytestring" "ghc-prim"]; - ghc-heap.depends = ["base" "containers" "ghc-prim" "rts"]; + ghc-experimental.depends = ["base" "ghc-internal" "ghc-prim"]; + ghc-heap.depends = ["base" "containers" "ghc-internal" "ghc-prim" "rts"]; + ghc-internal.depends = ["ghc-bignum" "ghc-prim" "rts"]; + ghc-platform.depends = ["base"]; ghc-prim.depends = ["rts"]; + ghc-toolchain.depends = ["base" "directory" "filepath" "ghc-platform" "process" "text" "transformers"]; ghci.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "filepath" "ghc-boot" "ghc-heap" "ghc-prim" "rts" "template-haskell" "transformers" "unix"]; haskeline.depends = ["base" "bytestring" "containers" "directory" "exceptions" "filepath" "process" "stm" "terminfo" "transformers" "unix"]; hpc.depends = ["base" "containers" "deepseq" "directory" "filepath" "time"]; - integer-gmp.depends = ["base" "ghc-bignum" "ghc-prim"]; + integer-gmp.depends = ["base" "ghc-bignum" "ghc-internal" "ghc-prim"]; mtl.depends = ["base" "transformers"]; + os-string.depends = ["base" "bytestring" "deepseq" "exceptions" "template-haskell"]; # parsec.depends = ["base" "bytestring" "mtl" "text"]; pretty.depends = ["base" "deepseq" "ghc-prim"]; process.depends = ["base" "deepseq" "directory" "filepath" "unix"]; @@ -368,7 +380,7 @@ let # text.depends = ["array" "base" "binary" "bytestring" "deepseq" "ghc-prim" "template-haskell"]; time.depends = ["base" "deepseq"]; transformers.depends = ["base"]; - unix.depends = ["base" "bytestring" "filepath" "time"]; + unix.depends = ["base" "bytestring" "filepath" "os-string" "time"]; xhtml.depends = ["base"]; ghc.version = ghc.version; From f58edba355d71a7bb5fa526e24355f080e9caa10 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 16:00:59 +1200 Subject: [PATCH 20/82] Refactor commment --- lib/call-cabal-project-to-nix.nix | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 830f613aac..d89d622d8b 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -334,12 +334,20 @@ let }; ghc-pkgs = { - # GHC 9.8 - # Cabal.depends = ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "text" "time" "transformers" "unix"]; - # Cabal-syntax.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers" "unix"]; - # GHC 9.10 - # Cabal.depends = ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "time" "transformers" "unix"]; - # Cabal-syntax.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers"]; + # This list was derived from the output of: + # for a in $(ghc-pkg list | tr '\n' ' ' | sed -e 's| *| |g' -e 's|^[^ ]*||' -e 's|-[0-9][^ ]*||g' -e 's| (| |'); do ghc-pkg field $a depends | tr '\n' ' ' | sed -e 's| *| |g' -e 's|^depends: ||' -e 's|-[0-9][^ ]*||g' -e 's| *$||' -e 's| |" "|g' -e "s|^| $a.depends = [\"|" -e 's|$|"];|'; echo; done + # If a package is not included in the GHC source it will be left out. + # Include conditional code if: + # * A dependency is removed + # * A dependency to an already existing package is added + # Cabal.depends = + # if builtins.compareVersions ghc.version "9.10" >= 0 + # then ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "time" "transformers" "unix"] + # else ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "text" "time" "transformers" "unix"]; + # Cabal-syntax.depends = + # if builtins.compareVersions ghc.version "9.10" >= 0 + # then ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers"] + # else ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers" "unix"]; array.depends = ["base"]; base.depends = if builtins.compareVersions ghc.version "9.10" >= 0 From 9eed8acf87984a034822d488fc39874b66845ebe Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 16:31:26 +1200 Subject: [PATCH 21/82] ifdLevel 1 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 267ed37ca8..6718eb01d2 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 3 +{ ifdLevel ? 1 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From 74440975b4b05bff852054e0014b8ea4a59d05d2 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 17:05:53 +1200 Subject: [PATCH 22/82] ifdLevel 2 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 6718eb01d2..3894974a01 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 1 +{ ifdLevel ? 2 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From cf9bb26bf738adce956de061c4c138f15e3e81c3 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 17:43:48 +1200 Subject: [PATCH 23/82] ifdLevel 3 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 3894974a01..267ed37ca8 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 2 +{ ifdLevel ? 3 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From d58d4117a2361d3c783e953a6b15a56b509ddd42 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 17 Apr 2024 18:22:14 +1200 Subject: [PATCH 24/82] Add cabal2json to static-nix-tools --- nix-tools/cabal.project | 10 +++++++--- nix-tools/nix-tools/nix-tools.cabal | 4 ++-- nix-tools/overlay.nix | 7 +++++-- nix-tools/static/project.nix | 5 ++++- nix-tools/static/zipped.nix | 1 + 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/nix-tools/cabal.project b/nix-tools/cabal.project index 9a4777ccaa..4c5b85330a 100644 --- a/nix-tools/cabal.project +++ b/nix-tools/cabal.project @@ -1,13 +1,11 @@ index-state: 2024-03-28T00:00:00Z -with-compiler: ghc-9.2.8 - packages: nix-tools -- haskell.nix expects nix-tools to provide the cabal and hpack executables -- so we put these two packages here, so they will be present even if nix-tools -- dependencies change -extra-packages: cabal-install, hpack +extra-packages: cabal-install, hpack, Cabal-syntax-json test-show-details: direct @@ -29,3 +27,9 @@ source-repository-package location: https://github.com/michaelpj/hackage-db.git tag: f3b9240212b036391871e4ea09891e91efcea7a1 --sha256: sha256-n0ATmkwtR68E2FuZK3QIQgZirVmWbd21vIQmzhGKsRw= + +source-repository-package + type: git + location: https://github.com/andreabedini/Cabal-syntax-json.git + tag: bf97be0038489239a11c61653b55afc77356ac1e + --sha256: sha256-i9TEqQqRqFM07q1Lr6wcMlURhBkhkVxHhP1jQjSE+Yg= diff --git a/nix-tools/nix-tools/nix-tools.cabal b/nix-tools/nix-tools/nix-tools.cabal index 5488268cfc..5936f46958 100644 --- a/nix-tools/nix-tools/nix-tools.cabal +++ b/nix-tools/nix-tools/nix-tools.cabal @@ -29,7 +29,7 @@ library , Stack2nix.External.Resolve , Stack2nix.Project , Stack2nix.Stack - build-depends: base >= 4 && <4.18 + build-depends: base >= 4 && <4.20 , Cabal >= 3.10.3 && <3.11 , Cabal-syntax >= 3.10 && <3.11 , aeson >= 2.0 && <2.3 @@ -46,7 +46,7 @@ library -- Needs https://github.com/input-output-hk/iohk-nix/commit/6a8c29117eff36ce975e02e01efc8b25d93fcb90#diff-6fb0c6517b547a8baf082d5d2d604842 -- to work with the data-dir issues when building components. -- This commit is included since 0.6.5. - , hnix >= 0.6.5 && <0.17 + , hnix >= 0.6.5 && <0.18 , hpack , http-client , http-client-tls diff --git a/nix-tools/overlay.nix b/nix-tools/overlay.nix index 55fc6365bb..5d63272fbf 100644 --- a/nix-tools/overlay.nix +++ b/nix-tools/overlay.nix @@ -1,7 +1,7 @@ final: _prev: let - compiler-nix-name = "ghc8107"; + compiler-nix-name = "ghc964"; nix-tools = nix-tools-set { nix-tools = nix-tools-unchecked; @@ -18,7 +18,7 @@ let src = ./.; compiler-nix-name = final.lib.mkDefault compiler-nix-name; - compilerSelection = p: p.haskell.compiler; + # compilerSelection = p: p.haskell.compiler; # tests need to fetch hackage configureArgs = final.lib.mkDefault "--disable-tests"; @@ -54,6 +54,9 @@ let inherit (project.hsPkgs.hpack.components.exes) hpack; + + inherit (project.hsPkgs.Cabal-syntax-json.components.exes) + cabal2json; }; warning = final.lib.mapAttrs diff --git a/nix-tools/static/project.nix b/nix-tools/static/project.nix index fa275759f3..df00d692f4 100644 --- a/nix-tools/static/project.nix +++ b/nix-tools/static/project.nix @@ -40,6 +40,9 @@ let plan-to-nix.dontStrip = false; stack-repos.dontStrip = false; }; + packages.cabal-install.components.exes.cabal.dontStrip = false; + packages.hpack.components.exes.hpack.dontStrip = false; + packages.Cabal-syntax-json.components.exes.cabal2json.dontStrip = false; }; @@ -58,7 +61,7 @@ let static-nix-tools-project = pkgs.haskell-nix.project' { - compiler-nix-name = "ghc928"; + compiler-nix-name = "ghc964"; src = ../.; diff --git a/nix-tools/static/zipped.nix b/nix-tools/static/zipped.nix index 44898d49c1..c6390818c6 100644 --- a/nix-tools/static/zipped.nix +++ b/nix-tools/static/zipped.nix @@ -35,6 +35,7 @@ let drvs' = [ hsPkgs.cabal-install.components.exes.cabal hsPkgs.hpack.components.exes.hpack + hsPkgs.Cabal-syntax-json.components.exes.cabal2json ] ++ strippedNixToolsComponents; }; From 2997b248b7f920bb1722bae48837cec58676a717 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 18 Apr 2024 14:03:35 +1200 Subject: [PATCH 25/82] Use ghc928 --- nix-tools/static/project.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-tools/static/project.nix b/nix-tools/static/project.nix index df00d692f4..d79a0467e4 100644 --- a/nix-tools/static/project.nix +++ b/nix-tools/static/project.nix @@ -61,7 +61,7 @@ let static-nix-tools-project = pkgs.haskell-nix.project' { - compiler-nix-name = "ghc964"; + compiler-nix-name = "ghc928"; src = ../.; From e78a09949f229f96c22a18d3197e0887aed56cb3 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 18 Apr 2024 15:18:52 +1200 Subject: [PATCH 26/82] More fixes --- lib/call-cabal-project-to-nix.nix | 2 +- test/cabal.project.local | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index d89d622d8b..567ff2d0be 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -353,7 +353,7 @@ let if builtins.compareVersions ghc.version "9.10" >= 0 then ["ghc-internal" "ghc-prim"] else ["ghc-bignum" "ghc-prim" "rts"]; - binary.depends = ["array" "base" "bytestring" "containers"]; + # binary.depends = ["array" "base" "bytestring" "containers"]; # bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; # containers.depends = ["array" "base" "deepseq" "template-haskell"]; deepseq.depends = ["array" "base" "ghc-prim"]; diff --git a/test/cabal.project.local b/test/cabal.project.local index 79f8c04105..9dec422a5e 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -18,7 +18,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-ddxP+nxBsM0SLvaiiB80k5DpX0PsKJq9VXhESPHKAF8= + --sha256: sha256-FMvKnUzQUJvfZPpMtpzUHAz8X67qi+LUM/AZ/+CImrs= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ed91ac93832fdfc50471ab8df13b8174e91b35ed @@ -31,10 +31,10 @@ if !impl(ghc>=9.10) && !os(ghcjs) active-repositories: hackage.haskell.org if impl(ghc>=9.10) && !os(ghcjs) - active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org if !impl(ghc>=9.10) && os(ghcjs) active-repositories: hackage.haskell.org, ghcjs-overlay:override if impl(ghc>=9.10) && os(ghcjs) - active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override, ghcjs-overlay:override + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org, ghcjs-overlay:override From c8eb5d013a9edbfc9ac47d8692864d2f5e421407 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 18 Apr 2024 16:44:37 +1200 Subject: [PATCH 27/82] Fix for darwin --- nix-tools/static/project.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix-tools/static/project.nix b/nix-tools/static/project.nix index d79a0467e4..e7ed7832e7 100644 --- a/nix-tools/static/project.nix +++ b/nix-tools/static/project.nix @@ -56,6 +56,9 @@ let packages.nix-tools.ghcOptions = [ "-L${pkgs.lib.getLib pkgs.static-gmp}/lib" ]; + packages.Cabal-syntax-json.ghcOptions = [ + "-L${pkgs.lib.getLib pkgs.static-gmp}/lib" + ]; }; From 63c4c895156318e687350213c0814aef8aced937 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 18 Apr 2024 17:33:28 +1200 Subject: [PATCH 28/82] ifdLevel 1 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 267ed37ca8..6718eb01d2 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 3 +{ ifdLevel ? 1 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From 2d639b33126efe421b783bbb1a581ad25937d154 Mon Sep 17 00:00:00 2001 From: Auto Update Bot Date: Thu, 18 Apr 2024 05:34:00 +0000 Subject: [PATCH 29/82] update nix-tools-static.nix --- nix-tools-static.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nix-tools-static.nix b/nix-tools-static.nix index 783d7b6fc6..eadccddd78 100644 --- a/nix-tools-static.nix +++ b/nix-tools-static.nix @@ -1,22 +1,22 @@ -pkgs: let baseurl = "https://github.com/input-output-hk/haskell.nix/releases/download/nix-tools-0.1.7/"; in { +pkgs: let baseurl = "https://github.com/input-output-hk/haskell.nix/releases/download/nix-tools-0.1.8/"; in { aarch64-darwin = pkgs.fetchurl { name = "aarch64-darwin-nix-tools-static"; url = "${baseurl}aarch64-darwin-nix-tools-static.zip"; - sha256 = "sha256-f8XbWzHV+yriUvPCxEOt7CuVN5pfE4rbz37OPRG8j7U="; + sha256 = "sha256-du+QOnEkjVQFHiwHr7NGOku/fmvBUCFYRPipzU/MRPc="; }; x86_64-darwin = pkgs.fetchurl { name = "x86_64-darwin-nix-tools-static"; url = "${baseurl}x86_64-darwin-nix-tools-static.zip"; - sha256 = "sha256-kLy9lqJKaISgnfkyiQf7uupRImt3vR/szwXxR+rmDic="; + sha256 = "sha256-I55Mn6iKYxy3uoQp3DyhuJOvUJ+mDP9In9DyuEaw6K4="; }; aarch64-linux = pkgs.fetchurl { name = "aarch64-linux-nix-tools-static"; url = "${baseurl}aarch64-linux-nix-tools-static.zip"; - sha256 = "sha256-GBq5/JsZamuUZLIXEWxVk5Xnj6eZeQU6vX7ceAcBmAM="; + sha256 = "sha256-kx06o5tzow6PCdkV+mlQW4TQHdkEZGtSvH4sij5ZaYk="; }; x86_64-linux = pkgs.fetchurl { name = "x86_64-linux-nix-tools-static"; url = "${baseurl}x86_64-linux-nix-tools-static.zip"; - sha256 = "sha256-+tFokn7TNptt2BkROc6QVy2KgWNmPzPVv4tUCm/E7vI="; + sha256 = "sha256-02mBvbW5WT+0fY9n2RIbrNnMwpJIHZ5obgmFXDTz8Ds="; }; } From c634d87ccfa7c395b873cfca1048fcdf87072ed1 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 18 Apr 2024 17:35:10 +1200 Subject: [PATCH 30/82] ifdLevel 2 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 6718eb01d2..3894974a01 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 1 +{ ifdLevel ? 2 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From 5f4bbcbea49ec2f196b5f9178973fd2c141a2206 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 18 Apr 2024 20:35:45 +1200 Subject: [PATCH 31/82] ifdLevel 3 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 3894974a01..267ed37ca8 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 2 +{ ifdLevel ? 3 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From cdcc6f8d034d44c8ea60beecbf0565782c499019 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 18 Apr 2024 23:47:46 +1200 Subject: [PATCH 32/82] ifdLevel 1 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 267ed37ca8..6718eb01d2 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 3 +{ ifdLevel ? 1 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From 43720c726849fa7ce201279fba9102184caff0f7 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 18 Apr 2024 23:48:35 +1200 Subject: [PATCH 33/82] ifdLevel 2 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 6718eb01d2..3894974a01 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 1 +{ ifdLevel ? 2 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From 7b7b4db2131712902b946908c44893b2102566b9 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 19 Apr 2024 09:56:12 +1200 Subject: [PATCH 34/82] ifdLevel 0 --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index 3894974a01..75286cd955 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 2 +{ ifdLevel ? 0 , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" From 4d02393d06decb3d21f8d10abc702cacac373e05 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 19 Apr 2024 11:48:28 +1200 Subject: [PATCH 35/82] Exclude nix-tools for ifdLevel <3 --- ci.nix | 2 +- flake.nix | 16 +++++----- nix-tools/flake.lock | 70 ++++++++++++++++++++++---------------------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/ci.nix b/ci.nix index 75286cd955..e4a775af81 100644 --- a/ci.nix +++ b/ci.nix @@ -1,6 +1,6 @@ # 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating # on a machine with e.g. no way to build the Darwin IFDs you need! -{ ifdLevel ? 0 +{ ifdLevel # This is passed in from flake.nix , checkMaterialization ? false , system ? builtins.currentSystem , evalSystem ? builtins.currentSystem or "x86_64-linux" diff --git a/flake.nix b/flake.nix index c1b1d657fa..77b2a4c3c8 100644 --- a/flake.nix +++ b/flake.nix @@ -97,6 +97,7 @@ let callFlake = import flake-compat; + ifdLevel = 0; compiler = "ghc928"; config = import ./config.nix; @@ -208,7 +209,7 @@ stripAttrsForHydra (filterDerivations ( # This is awkward. import ./ci.nix { - inherit system; + inherit ifdLevel system; haskellNix = self; }))); @@ -238,19 +239,18 @@ hydraJobs = forEachSystem (system: let # Include hydraJobs from nix-tools subflake. - # NOTE: These derivations do not depend on the haskell.nix in ./. but - # on the version of haskell.nix locked in the subflake. They are - # evaluated within their own flake and independently of anything - # else. Here we only expose them in the main flake. nix-tools-hydraJobs = let cf = callFlake { inherit system; pkgs = self.legacyPackages.${system}; src = ./nix-tools; + override-inputs.haskellNix = self; }; in cf.defaultNix.hydraJobs; in - self.allJobs.${system} // { nix-tools = nix-tools-hydraJobs.${system} or {}; } + self.allJobs.${system} + // lib.optionalAttrs (ifdLevel > 2) + { nix-tools = nix-tools-hydraJobs.${system} or {}; } ); devShells = forEachSystemPkgs (pkgs: @@ -285,7 +285,7 @@ ); }; in with (import nixpkgs { system = "x86_64-linux"; }); traceHydraJobs (lib.recursiveUpdate flake { - hydraJobs.nix-tools = pkgs.releaseTools.aggregate { + hydraJobs.nix-tools = pkgs.releaseTools.aggregate (lib.optionalAttrs (ifdLevel > 2) { name = "nix-tools"; constituents = [ "aarch64-darwin.nix-tools.static.zipped.nix-tools-static" @@ -298,7 +298,7 @@ "x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd" (writeText "gitrev" (self.rev or "0000000000000000000000000000000000000000")) ]; - }; + }); }); # --- Flake Local Nix Configuration ---------------------------- diff --git a/nix-tools/flake.lock b/nix-tools/flake.lock index 00f2c559f1..610b435f13 100644 --- a/nix-tools/flake.lock +++ b/nix-tools/flake.lock @@ -120,11 +120,11 @@ "ghc910X": { "flake": false, "locked": { - "lastModified": 1709693152, - "narHash": "sha256-j7K/oZLy1ZZIpOsjq101IF7cz/i/UxY1ofIeNUfuuXc=", + "lastModified": 1711543129, + "narHash": "sha256-MUI07CxYOng7ZwHnMCw0ugY3HmWo2p/f4r07CGV7OAM=", "ref": "ghc-9.10", - "rev": "21e3f3250e88640087a1a60bee2cc113bf04509f", - "revCount": 62524, + "rev": "6ecd5f2ff97af53c7334f2d8581651203a2c6b7d", + "revCount": 62607, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" @@ -139,11 +139,11 @@ "ghc911": { "flake": false, "locked": { - "lastModified": 1710286031, - "narHash": "sha256-fz71zsU/ZukFMUsRNk2Ro3xTNMKsNrpvQtRtPqRI60c=", + "lastModified": 1711538967, + "narHash": "sha256-KSdOJ8seP3g30FaC2du8QjU9vumMnmzPR5wfkVRXQMk=", "ref": "refs/heads/master", - "rev": "e6bfb85c842edca36754bb8914e725fbaa1a83a6", - "revCount": 62586, + "rev": "0acfe391583d77a72051d505f05fab0ada056c49", + "revCount": 62632, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" @@ -157,11 +157,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1711931084, - "narHash": "sha256-goTZYO69KUv7NeP8bhiuyR+VRTk9tk5cHTkkWLvw1d8=", + "lastModified": 1713399842, + "narHash": "sha256-e2WgMXaoos+dJld+KcntBMqnS4tqtlKnXBFC+4KTuyA=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "39fbc1a06c422905a573beb2e81db7b73e31e099", + "rev": "db08c82c5085b992f88f1dc48ab543b347496653", "type": "github" }, "original": { @@ -189,10 +189,10 @@ "hls-2.4": "hls-2.4", "hls-2.5": "hls-2.5", "hls-2.6": "hls-2.6", + "hls-2.7": "hls-2.7", "hpc-coveralls": "hpc-coveralls", "hydra": "hydra", "iserv-proxy": "iserv-proxy", - "nix-tools-static": "nix-tools-static", "nixpkgs": [ "haskellNix", "nixpkgs-unstable" @@ -209,11 +209,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1711932614, - "narHash": "sha256-saNroCQcgXFbdgFoBv0Ff7uxcDfp09HSkoqN+NpbPNE=", + "lastModified": 1713401416, + "narHash": "sha256-n+ECHMHb5Yzz5n9F2BkK7YbRXdlRF/bs5CCpRT2KczU=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "a14aea84e0ee71df20505426459fa5544a261fed", + "rev": "7ff394777d4ba0505fd41a388d52994d250766e6", "type": "github" }, "original": { @@ -341,6 +341,23 @@ "type": "github" } }, + "hls-2.7": { + "flake": false, + "locked": { + "lastModified": 1708965829, + "narHash": "sha256-LfJ+TBcBFq/XKoiNI7pc4VoHg4WmuzsFxYJ3Fu+Jf+M=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "50322b0a4aefb27adc5ec42f5055aaa8f8e38001", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.7.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, "hpc-coveralls": { "flake": false, "locked": { @@ -434,23 +451,6 @@ "type": "github" } }, - "nix-tools-static": { - "flake": false, - "locked": { - "lastModified": 1706266250, - "narHash": "sha256-9t+GRk3eO9muCtKdNAwBtNBZ5dH1xHcnS17WaQyftwA=", - "owner": "input-output-hk", - "repo": "haskell-nix-example", - "rev": "580cb6db546a7777dad3b9c0fa487a366c045c4e", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "ref": "nix", - "repo": "haskell-nix-example", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1657693803, @@ -640,11 +640,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1711930228, - "narHash": "sha256-hR0tP4AfdJr7YUsL7GX6YdOb7oqZ8wwC3yC/YKJ8Q6U=", + "lastModified": 1713399049, + "narHash": "sha256-BqDuOZMwj3bVfnpjZgCag0VTgY6wCcCJTfLYkt3S/c0=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "d10c550568fec53cddf8367401407782419b4795", + "rev": "6f7558135ca710c87348f4049758d69b110ce47f", "type": "github" }, "original": { From 7477217e3dfc380d2aee1178f66b6f5bc15c8412 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 19 Apr 2024 11:51:28 +1200 Subject: [PATCH 36/82] ifdLevel 1 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 77b2a4c3c8..03fb9291d6 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 0; + ifdLevel = 1; compiler = "ghc928"; config = import ./config.nix; From ab8cf0099b3428422d2704954acaac544d8f2625 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 19 Apr 2024 12:06:59 +1200 Subject: [PATCH 37/82] Exclude nix-tools for ifdLevel <3 --- flake.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 03fb9291d6..90f7ffe738 100644 --- a/flake.nix +++ b/flake.nix @@ -284,8 +284,8 @@ "ghc921" "ghc922" "ghc923"]) ); }; in with (import nixpkgs { system = "x86_64-linux"; }); - traceHydraJobs (lib.recursiveUpdate flake { - hydraJobs.nix-tools = pkgs.releaseTools.aggregate (lib.optionalAttrs (ifdLevel > 2) { + traceHydraJobs (lib.recursiveUpdate flake (lib.optionalAttrs (ifdLevel > 2) { + hydraJobs.nix-tools = pkgs.releaseTools.aggregate { name = "nix-tools"; constituents = [ "aarch64-darwin.nix-tools.static.zipped.nix-tools-static" @@ -298,8 +298,8 @@ "x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd" (writeText "gitrev" (self.rev or "0000000000000000000000000000000000000000")) ]; - }); - }); + }; + })); # --- Flake Local Nix Configuration ---------------------------- nixConfig = { From 3204a36b78f95cf718d133229f80d16819a576ba Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 19 Apr 2024 13:51:07 +1200 Subject: [PATCH 38/82] ifdLevel 0 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 90f7ffe738..26625105ce 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 1; + ifdLevel = 0; compiler = "ghc928"; config = import ./config.nix; From 6ef4b657e9a656232ffd4ff621e47ae86bdd2c07 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 19 Apr 2024 20:55:24 +1200 Subject: [PATCH 39/82] ifdLevel 1 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 26625105ce..90f7ffe738 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 0; + ifdLevel = 1; compiler = "ghc928"; config = import ./config.nix; From a016440278384bc631b6e82dffce969d633f4667 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 19 Apr 2024 22:10:09 +1200 Subject: [PATCH 40/82] ifdLevel 2 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 90f7ffe738..07edbb19ce 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 1; + ifdLevel = 2; compiler = "ghc928"; config = import ./config.nix; From 8a1e3be9346848ff5b440c8aebb5407a030cb17c Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 20 Apr 2024 01:22:21 +1200 Subject: [PATCH 41/82] ifdLevel 0 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 07edbb19ce..26625105ce 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 2; + ifdLevel = 0; compiler = "ghc928"; config = import ./config.nix; From 2efa20f3b0e91465b143aab4cd2afcd52b21ba26 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 20 Apr 2024 01:59:46 +1200 Subject: [PATCH 42/82] ifdLevel 1 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 26625105ce..90f7ffe738 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 0; + ifdLevel = 1; compiler = "ghc928"; config = import ./config.nix; From 582c7c68d3e7cc726ce2c37007d789b30f135d30 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 20 Apr 2024 02:02:19 +1200 Subject: [PATCH 43/82] ifdLevel 2 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 90f7ffe738..07edbb19ce 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 1; + ifdLevel = 2; compiler = "ghc928"; config = import ./config.nix; From 5e6acfb674b8fa26270f68b3583f4835e0372efa Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Mon, 22 Apr 2024 01:34:17 +1200 Subject: [PATCH 44/82] ifdLevel 3 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 07edbb19ce..1531f887df 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 2; + ifdLevel = 3; compiler = "ghc928"; config = import ./config.nix; From 1a8b993c6d1035269d2850df699813317eef8201 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 09:23:10 +1200 Subject: [PATCH 45/82] Keep haskell.nix pinned in nix-tools --- flake.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 1531f887df..3efa8bb545 100644 --- a/flake.nix +++ b/flake.nix @@ -239,12 +239,15 @@ hydraJobs = forEachSystem (system: let # Include hydraJobs from nix-tools subflake. + # NOTE: These derivations do not depend on the haskell.nix in ./. but + # on the version of haskell.nix locked in the subflake. They are + # evaluated within their own flake and independently of anything + # else. Here we only expose them in the main flake. nix-tools-hydraJobs = let cf = callFlake { inherit system; pkgs = self.legacyPackages.${system}; src = ./nix-tools; - override-inputs.haskellNix = self; }; in cf.defaultNix.hydraJobs; in From 882d38b56cbcbc1be9d2eef52b0e9d0329e5bf13 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 10:27:10 +1200 Subject: [PATCH 46/82] Add missing evalPackages arg --- ci.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.nix b/ci.nix index e4a775af81..6b057facd0 100644 --- a/ci.nix +++ b/ci.nix @@ -149,7 +149,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc: // pkgs.lib.optionalAttrs (ifdLevel >= 2 && crossSystemName != "ghcjs") pkgs.haskell-nix.iserv-proxy-exes.${compiler-nix-name} // pkgs.lib.optionalAttrs (ifdLevel >= 3) { - hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).getComponent "exe:hello"; + hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit evalPackages compiler-nix-name; }).getComponent "exe:hello"; }) )) ) From 85188cbaa35ea868b12172ebc7491df970a8f04c Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 12:21:47 +1200 Subject: [PATCH 47/82] Stick with pinned hadrian plans and haskell.nix --- compiler/ghc/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index 56673fa8a8..de055902c7 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -246,10 +246,20 @@ let then "ghc928" else "ghc962"; in - buildPackages.haskell-nix.tool compiler-nix-name "hadrian" { + buildPackages.pinned-haskell-nix.tool compiler-nix-name "hadrian" { compilerSelection = p: p.haskell.compiler; index-state = buildPackages.haskell-nix.internalHackageIndexState; # Verions of hadrian that comes with 9.6 depends on `time` + materialized = + if builtins.compareVersions ghc-version "9.4" < 0 + then ../../materialized/${compiler-nix-name}/hadrian-ghc92 + else if builtins.compareVersions ghc-version "9.6" < 0 + then ../../materialized/${compiler-nix-name}/hadrian-ghc94 + else if builtins.compareVersions ghc-version "9.8" < 0 + then ../../materialized/${compiler-nix-name}/hadrian-ghc96 + else if builtins.compareVersions ghc-version "9.9" < 0 + then ../../materialized/${compiler-nix-name}/hadrian-ghc98 + else ../../materialized/${compiler-nix-name}/hadrian-ghc99; modules = [{ # Apply the patches in a way that does not require using something # like `srcOnly`. The problem with `pkgs.srcOnly` was that it had to run From 9a017be62adbcbd67682de60903c65ee9bca7b0d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 12:38:03 +1200 Subject: [PATCH 48/82] Use configured-src for boot packages (to avoid ghc rebuilds for now) --- overlays/ghc-packages.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/overlays/ghc-packages.nix b/overlays/ghc-packages.nix index 2160ec5934..d426599609 100644 --- a/overlays/ghc-packages.nix +++ b/overlays/ghc-packages.nix @@ -181,9 +181,7 @@ in rec { inherit subDir; includeSiblings = true; } // { srcForCabal2Nix = ghc.passthru.configured-src + "/${subDir}"; } - else if builtins.elem subDir ["libraries/ghc-heap" "utils/remote-iserv" "libraries/ghci" "libraries/template-haskell" "utils/iserv" "libraries/ghc-prim" "libraries/libiserv" "utils/iserv-proxy"] - then "${ghc.passthru.configured-src}/${subDir}" - else "${ghc.passthru.raw-src}/${subDir}"; + else "${ghc.passthru.configured-src}/${subDir}"; nix = callCabal2Nix ghcName "${ghcName}-${pkgName}" src; }) (ghc-extra-pkgs ghc.version)) final.buildPackages.haskell-nix.compiler; From 24047bac0c47e06615bba254aa92014fde882947 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 12:45:29 +1200 Subject: [PATCH 49/82] Use configured-src for boot packages (to avoid ghc rebuilds for now) --- builder/hspkg-builder.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/hspkg-builder.nix b/builder/hspkg-builder.nix index 022967fb00..88ede9942d 100644 --- a/builder/hspkg-builder.nix +++ b/builder/hspkg-builder.nix @@ -26,7 +26,7 @@ let }."${compiler-nix-name}/${name}" or null; src = if bundledSrc != null - then ghc.raw-src + bundledSrc + then ghc.configured-src + bundledSrc else pkg.src; cabalFile = if package-description-override == null || bundledSrc != null then null else package-description-override; From fb862f0b66b988b2db6045915de92f10562730e4 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 13:49:56 +1200 Subject: [PATCH 50/82] Add terminfo as ghc dep for older ghc --- lib/call-cabal-project-to-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 567ff2d0be..a41f85c470 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -360,7 +360,7 @@ let directory.depends = ["base" "filepath" "os-string" "time" "unix"]; exceptions.depends = ["base" "mtl" "stm" "template-haskell" "transformers"]; filepath.depends = ["base" "bytestring" "deepseq" "exceptions" "os-string" "template-haskell"]; - ghc.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "exceptions" "filepath" "ghc-boot" "ghc-heap" "ghci" "hpc" "process" "semaphore-compat" "stm" "template-haskell" "time" "transformers" "unix"]; + ghc.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "exceptions" "filepath" "ghc-boot" "ghc-heap" "ghci" "hpc" "process" "semaphore-compat" "stm" "template-haskell" "terminfo" "time" "transformers" "unix"]; ghc-bignum.depends = ["ghc-prim"]; ghc-boot.depends = ["base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "ghc-boot-th" "ghc-platform" "unix"]; ghc-boot-th.depends = ["base"]; From dbef37162f59738dc15cb5152dbea60493c50065 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 14:13:59 +1200 Subject: [PATCH 51/82] ifdLevel 1 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 3efa8bb545..60f43fa43f 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 3; + ifdLevel = 1; compiler = "ghc928"; config = import ./config.nix; From fdf50d10b105f1f1e45ad3a6785bd92c0f011462 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 14:42:17 +1200 Subject: [PATCH 52/82] ifdLevel 2 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 60f43fa43f..da29c05a97 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 1; + ifdLevel = 2; compiler = "ghc928"; config = import ./config.nix; From 0b4668e09aa79e5416702c2f1dea40ed5f68505d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 23 Apr 2024 22:47:31 +1200 Subject: [PATCH 53/82] ifdLevel 3 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index da29c05a97..3efa8bb545 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 2; + ifdLevel = 3; compiler = "ghc928"; config = import ./config.nix; From 0c82671a7a6ff4486baf0106083482c9e78e928b Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 01:22:11 +1200 Subject: [PATCH 54/82] Fix for Windows cross compilation --- lib/call-cabal-project-to-nix.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index a41f85c470..bfb54878e4 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -357,10 +357,10 @@ let # bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; # containers.depends = ["array" "base" "deepseq" "template-haskell"]; deepseq.depends = ["array" "base" "ghc-prim"]; - directory.depends = ["base" "filepath" "os-string" "time" "unix"]; + directory.depends = ["base" "filepath" "os-string" "time" "unix" "Win32"]; exceptions.depends = ["base" "mtl" "stm" "template-haskell" "transformers"]; filepath.depends = ["base" "bytestring" "deepseq" "exceptions" "os-string" "template-haskell"]; - ghc.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "exceptions" "filepath" "ghc-boot" "ghc-heap" "ghci" "hpc" "process" "semaphore-compat" "stm" "template-haskell" "terminfo" "time" "transformers" "unix"]; + ghc.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "exceptions" "filepath" "ghc-boot" "ghc-heap" "ghci" "hpc" "process" "semaphore-compat" "stm" "template-haskell" "terminfo" "time" "transformers" "unix" "Win32"]; ghc-bignum.depends = ["ghc-prim"]; ghc-boot.depends = ["base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "ghc-boot-th" "ghc-platform" "unix"]; ghc-boot-th.depends = ["base"]; @@ -372,23 +372,22 @@ let ghc-prim.depends = ["rts"]; ghc-toolchain.depends = ["base" "directory" "filepath" "ghc-platform" "process" "text" "transformers"]; ghci.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "filepath" "ghc-boot" "ghc-heap" "ghc-prim" "rts" "template-haskell" "transformers" "unix"]; - haskeline.depends = ["base" "bytestring" "containers" "directory" "exceptions" "filepath" "process" "stm" "terminfo" "transformers" "unix"]; + haskeline.depends = ["base" "bytestring" "containers" "directory" "exceptions" "filepath" "process" "stm" "terminfo" "transformers" "unix" "Win32"]; hpc.depends = ["base" "containers" "deepseq" "directory" "filepath" "time"]; integer-gmp.depends = ["base" "ghc-bignum" "ghc-internal" "ghc-prim"]; mtl.depends = ["base" "transformers"]; os-string.depends = ["base" "bytestring" "deepseq" "exceptions" "template-haskell"]; # parsec.depends = ["base" "bytestring" "mtl" "text"]; pretty.depends = ["base" "deepseq" "ghc-prim"]; - process.depends = ["base" "deepseq" "directory" "filepath" "unix"]; + process.depends = ["base" "deepseq" "directory" "filepath" "unix" "Win32"]; rts.depends = []; - semaphore-compat.depends = ["base" "exceptions" "unix"]; + semaphore-compat.depends = ["base" "exceptions" "unix" "Win32"]; stm.depends = ["array" "base"]; template-haskell.depends = ["base" "ghc-boot-th" "ghc-prim" "pretty"]; terminfo.depends = ["base"]; # text.depends = ["array" "base" "binary" "bytestring" "deepseq" "ghc-prim" "template-haskell"]; - time.depends = ["base" "deepseq"]; + time.depends = ["base" "deepseq" "Win32"]; transformers.depends = ["base"]; - unix.depends = ["base" "bytestring" "filepath" "os-string" "time"]; xhtml.depends = ["base"]; ghc.version = ghc.version; @@ -396,7 +395,10 @@ let ghc-boot-th.version = ghc.version; ghc-heap.version = ghc.version; ghci.version = ghc.version; - } // pkgs.lib.optionalAttrs (builtins.compareVersions ghc.version "9.2" >= 0) { + } // (if pkgs.stdenv.targetPlatform.isWindows + then { Win32.depends = ["base" "filepath"]; } + else { unix.depends = ["base" "bytestring" "filepath" "os-string" "time"]; } + ) // pkgs.lib.optionalAttrs (builtins.compareVersions ghc.version "9.2" >= 0) { system-cxx-std-lib.depends = []; system-cxx-std-lib.version = "1.0"; }; From d84ccb2c26f9d9e8333e8106219381cc38c82b33 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 14:30:59 +1200 Subject: [PATCH 55/82] Avoid old aeson --- test/cabal-simple-prof/cabal-simple.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cabal-simple-prof/cabal-simple.cabal b/test/cabal-simple-prof/cabal-simple.cabal index aef0f956db..ddcfac27b2 100644 --- a/test/cabal-simple-prof/cabal-simple.cabal +++ b/test/cabal-simple-prof/cabal-simple.cabal @@ -21,7 +21,7 @@ library build-depends: base , extra , safe - , aeson + , aeson > 2 -- hs-source-dirs: default-language: Haskell2010 From 827f968a99e6293bdf8e624b9b0a3aa5a1440af6 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 14:31:37 +1200 Subject: [PATCH 56/82] Fix `if os(linux)` in cabal files --- lib/call-cabal-project-to-nix.nix | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index bfb54878e4..621ff9181f 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -290,6 +290,8 @@ let ghcSrc = ghc.raw-src or ghc.buildGHC.raw-src; + fixPlatformString = x: builtins.replaceStrings ["-linux-gnu"] ["-linux"] x; + # Dummy `ghc` that uses the captured output dummy-ghc = evalPackages.writeTextFile { name = "dummy-" + ghc.name; @@ -319,7 +321,31 @@ let echo "$out/dumby-db" ;; --info*) - echo '[("Build platform","${pkgs.stdenv.buildPlatform.config}"),("Host platform","${pkgs.stdenv.hostPlatform.config}"),("Target platform","${pkgs.stdenv.targetPlatform.config}")]' + echo '[("target os", "${ + if pkgs.stdenv.targetPlatform.isLinux + then "OSLinux" + else if pkgs.stdenv.targetPlatform.isDarwin + then "OSDarwin" + else if pkgs.stdenv.targetPlatform.isWindows + then "OSMinGW32" + else if pkgs.stdenv.targetPlatform.isGHcjs + then "OSGhcjs" + else throw "Unknown target os ${pkgs.stdenv.targetPlatform.config}" + }")' + echo ',("target arch","${ + if pkgs.stdenv.targetPlatform.isx86_64 + then "ArchX86_64" + else if pkgs.stdenv.targetPlatform.isAarch64 + then "ArchAArch64" + else if pkgs.stdenv.targetPlatform.isJavsScript + then "ArchJavaScript" + else throw "Unknown target arch ${pkgs.stdenv.targetPlatform.config}" + }")' + echo ',("target platform string","${fixPlatformString pkgs.stdenv.targetPlatform.config}")' + echo ',("Build platform","${fixPlatformString pkgs.stdenv.buildPlatform.config}")' + echo ',("Host platform","${fixPlatformString pkgs.stdenv.hostPlatform.config}")' + echo ',("Target platform","${fixPlatformString pkgs.stdenv.targetPlatform.config}")' + echo ']' ;; --print-libdir*) echo $out/ghc/libdir From 776ee2d17025489f5b1c891579f49f4ddaba4b74 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 14:36:56 +1200 Subject: [PATCH 57/82] Avoid old aeson --- test/cabal-doctests/cabal-doctests-test.cabal | 2 +- test/cabal-simple-debug/cabal-simple.cabal | 2 +- test/cabal-simple/cabal-simple.cabal | 2 +- test/cabal-sublib/cabal-sublib.cabal | 2 +- test/sublib-docs/sublib-docs.cabal | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/cabal-doctests/cabal-doctests-test.cabal b/test/cabal-doctests/cabal-doctests-test.cabal index 36eb9ee6df..f6c2617742 100644 --- a/test/cabal-doctests/cabal-doctests-test.cabal +++ b/test/cabal-doctests/cabal-doctests-test.cabal @@ -16,7 +16,7 @@ library other-modules: Paths_cabal_doctests_test build-depends: base >=4.7 && <5, - aeson + aeson > 2 default-language: Haskell2010 test-suite doctests diff --git a/test/cabal-simple-debug/cabal-simple.cabal b/test/cabal-simple-debug/cabal-simple.cabal index aef0f956db..ddcfac27b2 100644 --- a/test/cabal-simple-debug/cabal-simple.cabal +++ b/test/cabal-simple-debug/cabal-simple.cabal @@ -21,7 +21,7 @@ library build-depends: base , extra , safe - , aeson + , aeson > 2 -- hs-source-dirs: default-language: Haskell2010 diff --git a/test/cabal-simple/cabal-simple.cabal b/test/cabal-simple/cabal-simple.cabal index aef0f956db..ddcfac27b2 100644 --- a/test/cabal-simple/cabal-simple.cabal +++ b/test/cabal-simple/cabal-simple.cabal @@ -21,7 +21,7 @@ library build-depends: base , extra , safe - , aeson + , aeson > 2 -- hs-source-dirs: default-language: Haskell2010 diff --git a/test/cabal-sublib/cabal-sublib.cabal b/test/cabal-sublib/cabal-sublib.cabal index ef75a33b60..973621b019 100644 --- a/test/cabal-sublib/cabal-sublib.cabal +++ b/test/cabal-sublib/cabal-sublib.cabal @@ -26,7 +26,7 @@ library library slib build-depends: extra , safe - , aeson + , aeson > 2 default-language: Haskell2010 executable cabal-sublib diff --git a/test/sublib-docs/sublib-docs.cabal b/test/sublib-docs/sublib-docs.cabal index 6ab6296258..10bd1594bc 100644 --- a/test/sublib-docs/sublib-docs.cabal +++ b/test/sublib-docs/sublib-docs.cabal @@ -29,7 +29,7 @@ library slib exposed-modules: Slib build-depends: extra , safe - , aeson + , aeson > 2 , base default-language: Haskell2010 hs-source-dirs: slib From eba5f077f249aa5d5bd544d907c15145ca41ff4e Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 14:37:54 +1200 Subject: [PATCH 58/82] ifdLevel 2 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 3efa8bb545..da29c05a97 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 3; + ifdLevel = 2; compiler = "ghc928"; config = import ./config.nix; From 1304eef050145a5d36ff78898230cb5f411c4523 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 14:40:16 +1200 Subject: [PATCH 59/82] ifdLevel 3 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index da29c05a97..3efa8bb545 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 2; + ifdLevel = 3; compiler = "ghc928"; config = import ./config.nix; From a582c6d2ac5a1d609c7e12decd2f88a9b6fdf367 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 15:16:32 +1200 Subject: [PATCH 60/82] Fix typo --- lib/call-cabal-project-to-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 621ff9181f..d23a8484bf 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -328,7 +328,7 @@ let then "OSDarwin" else if pkgs.stdenv.targetPlatform.isWindows then "OSMinGW32" - else if pkgs.stdenv.targetPlatform.isGHcjs + else if pkgs.stdenv.targetPlatform.isGhcjs then "OSGhcjs" else throw "Unknown target os ${pkgs.stdenv.targetPlatform.config}" }")' From b4dbe1ab9462c93107104eda2d0d98bd9260d1ab Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 15:28:01 +1200 Subject: [PATCH 61/82] Fix typo --- lib/call-cabal-project-to-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index d23a8484bf..7220ed5988 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -337,7 +337,7 @@ let then "ArchX86_64" else if pkgs.stdenv.targetPlatform.isAarch64 then "ArchAArch64" - else if pkgs.stdenv.targetPlatform.isJavsScript + else if pkgs.stdenv.targetPlatform.isJavaScript then "ArchJavaScript" else throw "Unknown target arch ${pkgs.stdenv.targetPlatform.config}" }")' From baa81786aa8b2840be1ec0921a755bfebad27f3f Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 20:05:47 +1200 Subject: [PATCH 62/82] Avoid old aeson --- test/cabal-source-repo-comments/cabal.project | 1 + test/cabal-source-repo/cabal.project | 1 + 2 files changed, 2 insertions(+) diff --git a/test/cabal-source-repo-comments/cabal.project b/test/cabal-source-repo-comments/cabal.project index b2fc5fc7e8..7d6813a19c 100644 --- a/test/cabal-source-repo-comments/cabal.project +++ b/test/cabal-source-repo-comments/cabal.project @@ -2,6 +2,7 @@ packages: ./ allow-newer: aeson:base, aeson:ghc-prim, aeson:template-haskell +constraints: aeson >2 source-repository-package -- Test diff --git a/test/cabal-source-repo/cabal.project b/test/cabal-source-repo/cabal.project index e24ff6866b..1fab0e0ecd 100644 --- a/test/cabal-source-repo/cabal.project +++ b/test/cabal-source-repo/cabal.project @@ -2,6 +2,7 @@ packages: ./ allow-newer: aeson:base, aeson:ghc-prim, aeson:template-haskell +constraints: aeson >2 source-repository-package type: git From cc75939bcb7489de0461e4d59579d042d7782e61 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 21:55:50 +1200 Subject: [PATCH 63/82] os-string 2 does not work with ghc 8.10 --- test/cabal.project.local | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/cabal.project.local b/test/cabal.project.local index 9dec422a5e..4404ce4b7d 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -7,6 +7,9 @@ if impl(ghc>=9.8) if impl(ghc > 9.9) allow-newer: *:containers +if impl(ghc <8.11) + constraints: os-string < 2.0 + -- This prevents hsc2hs from causing old versions of packages from being added to plan.json allow-newer: hsc2hs:* From f1d36477fe7cde67d09317a3824cbf44545dc80f Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 24 Apr 2024 22:09:28 +1200 Subject: [PATCH 64/82] Bump head.hackage --- test/cabal.project.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cabal.project.local b/test/cabal.project.local index 4404ce4b7d..959e4aeff5 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -21,7 +21,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-FMvKnUzQUJvfZPpMtpzUHAz8X67qi+LUM/AZ/+CImrs= + --sha256: sha256-L40SN6Nd071vEMvn5U0+PCKQvD/1U8WPwepbMrV94FA= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ed91ac93832fdfc50471ab8df13b8174e91b35ed From 7b72a59886a09478ee055b68a55326fa9dee3d42 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 25 Apr 2024 10:59:47 +1200 Subject: [PATCH 65/82] Fix for cabal-install on ghc 8.10 --- build.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.nix b/build.nix index 2bf29be8de..0aea21fc05 100644 --- a/build.nix +++ b/build.nix @@ -26,7 +26,13 @@ in rec { tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) ( pkgs.recurseIntoAttrs ({ - cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; }; + cabal-latest = tool compiler-nix-name "cabal" { + inherit evalPackages; + cabalProjectLocal = '' + if impl(ghc <8.11) + constraints: os-string < 2.0 + ''; + }; } // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) { hlint-latest = tool compiler-nix-name "hlint" { inherit evalPackages; From 982a3ddeb76fc6d26a0bcf4bc41a20dda2363e9d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 25 Apr 2024 12:09:39 +1200 Subject: [PATCH 66/82] nix flake update ghc910X and ghc911 --- flake.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index 5a5be99a52..eb6cf63271 100644 --- a/flake.lock +++ b/flake.lock @@ -120,11 +120,11 @@ "ghc910X": { "flake": false, "locked": { - "lastModified": 1711543129, - "narHash": "sha256-PZvNroYZF1fnK/cAVU2iKSZdbCFdnv+hDIjJ0xvR7Z4=", + "lastModified": 1713193157, + "narHash": "sha256-XFkrSrDyzZGEinXD6gV2zuj/lD5gJbbJhF5E5mI+wpE=", "ref": "ghc-9.10", - "rev": "6ecd5f2ff97af53c7334f2d8581651203a2c6b7d", - "revCount": 62607, + "rev": "26b6c7fdaf0ac6c5c68d76922c2339d0cfec6c6e", + "revCount": 62642, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" @@ -139,11 +139,11 @@ "ghc911": { "flake": false, "locked": { - "lastModified": 1711538967, - "narHash": "sha256-KSdOJ8seP3g30FaC2du8QjU9vumMnmzPR5wfkVRXQMk=", + "lastModified": 1713898958, + "narHash": "sha256-eXmPTWrIRH7Px+G4V5Uy5LwTlgMI30IVTSLXz7Dhmd4=", "ref": "refs/heads/master", - "rev": "0acfe391583d77a72051d505f05fab0ada056c49", - "revCount": 62632, + "rev": "3fff09779d5830549ae455a15907b7bb9fe7859a", + "revCount": 62764, "submodules": true, "type": "git", "url": "https://gitlab.haskell.org/ghc/ghc" From 898a7b1340004b67d1db0b385af3227ea684bf36 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 25 Apr 2024 15:34:44 +1200 Subject: [PATCH 67/82] ifdLevel 1 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 3efa8bb545..60f43fa43f 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 3; + ifdLevel = 1; compiler = "ghc928"; config = import ./config.nix; From df5445778886843f026860bf77d64f8c5a8b96e0 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 25 Apr 2024 19:13:19 +1200 Subject: [PATCH 68/82] ifdLevel 3 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 60f43fa43f..3efa8bb545 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ let callFlake = import flake-compat; - ifdLevel = 1; + ifdLevel = 3; compiler = "ghc928"; config = import ./config.nix; From a02e2504bd6f5087e06df692520f2c68d5c8a090 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Thu, 25 Apr 2024 23:53:54 +1200 Subject: [PATCH 69/82] Skip plugin test for git ghc --- test/plugin/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/default.nix b/test/plugin/default.nix index fe03ea2489..caa6b46718 100644 --- a/test/plugin/default.nix +++ b/test/plugin/default.nix @@ -21,7 +21,7 @@ in recurseIntoAttrs { # Not sure why this breaks for ghc 8.10.7 meta.disabled = compiler-nix-name == "ghc8107" - || builtins.elem compiler-nix-name [ "ghc910020240327" "ghc91120240327" ] + || builtins.elem compiler-nix-name [ "ghc910020240415" "ghc91120240423" ] || stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isGhcjs || stdenv.hostPlatform.isWindows From 6425443b34827cc129ddf7393c58b54b1f3d9e39 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 26 Apr 2024 10:55:33 +1200 Subject: [PATCH 70/82] TH dll fix for macOS && ghc<9.4 avoid simdutf --- test/th-dlls/cabal.project | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/th-dlls/cabal.project b/test/th-dlls/cabal.project index f686c244f5..b860d6c3a6 100644 --- a/test/th-dlls/cabal.project +++ b/test/th-dlls/cabal.project @@ -4,3 +4,5 @@ packages: . -- See https://github.com/haskell/network/issues/550 constraints: network <3.1.3.0 || >3.1.3.0 +if os(osx) && impl(ghc<9.4) + constraints: text -simdutf From 64e079b73f342be0bfc0e708478d5646fee36a20 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 26 Apr 2024 12:17:53 +1200 Subject: [PATCH 71/82] TH dll fix for macOS && ghc<9.4 avoid simdutf --- test/cabal.project.local | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/cabal.project.local b/test/cabal.project.local index 959e4aeff5..f5cb0354ed 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -10,6 +10,9 @@ if impl(ghc > 9.9) if impl(ghc <8.11) constraints: os-string < 2.0 +if os(osx) && impl(ghc <8.11) + constraints: text -simdutf + -- This prevents hsc2hs from causing old versions of packages from being added to plan.json allow-newer: hsc2hs:* From bd603eeb313bdf57091192bdf3aeab5f2fa27330 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 26 Apr 2024 14:01:42 +1200 Subject: [PATCH 72/82] Add supported-languages logic --- lib/supported-languages.nix | 578 +++++++++++++++++++----------------- 1 file changed, 304 insertions(+), 274 deletions(-) diff --git a/lib/supported-languages.nix b/lib/supported-languages.nix index 4fa2d51d7b..3d633db080 100644 --- a/lib/supported-languages.nix +++ b/lib/supported-languages.nix @@ -2,278 +2,308 @@ evalPackages.writeTextFile { name = "supported-languages"; text = '' -Haskell98 -Haskell2010 -GHC2021 -Unsafe -Trustworthy -Safe -AllowAmbiguousTypes -NoAllowAmbiguousTypes -AlternativeLayoutRule -NoAlternativeLayoutRule -AlternativeLayoutRuleTransitional -NoAlternativeLayoutRuleTransitional -Arrows -NoArrows -AutoDeriveTypeable -NoAutoDeriveTypeable -BangPatterns -NoBangPatterns -BinaryLiterals -NoBinaryLiterals -CApiFFI -NoCApiFFI -CPP -NoCPP -CUSKs -NoCUSKs -ConstrainedClassMethods -NoConstrainedClassMethods -ConstraintKinds -NoConstraintKinds -DataKinds -NoDataKinds -DatatypeContexts -NoDatatypeContexts -DefaultSignatures -NoDefaultSignatures -DeriveAnyClass -NoDeriveAnyClass -DeriveDataTypeable -NoDeriveDataTypeable -DeriveFoldable -NoDeriveFoldable -DeriveFunctor -NoDeriveFunctor -DeriveGeneric -NoDeriveGeneric -DeriveLift -NoDeriveLift -DeriveTraversable -NoDeriveTraversable -DerivingStrategies -NoDerivingStrategies -DerivingVia -NoDerivingVia -DisambiguateRecordFields -NoDisambiguateRecordFields -DoAndIfThenElse -NoDoAndIfThenElse -BlockArguments -NoBlockArguments -DoRec -NoDoRec -DuplicateRecordFields -NoDuplicateRecordFields -FieldSelectors -NoFieldSelectors -EmptyCase -NoEmptyCase -EmptyDataDecls -NoEmptyDataDecls -EmptyDataDeriving -NoEmptyDataDeriving -ExistentialQuantification -NoExistentialQuantification -ExplicitForAll -NoExplicitForAll -ExplicitNamespaces -NoExplicitNamespaces -ExtendedDefaultRules -NoExtendedDefaultRules -ExtendedLiterals -NoExtendedLiterals -FlexibleContexts -NoFlexibleContexts -FlexibleInstances -NoFlexibleInstances -ForeignFunctionInterface -NoForeignFunctionInterface -FunctionalDependencies -NoFunctionalDependencies -GADTSyntax -NoGADTSyntax -GADTs -NoGADTs -GHCForeignImportPrim -NoGHCForeignImportPrim -GeneralizedNewtypeDeriving -NoGeneralizedNewtypeDeriving -GeneralisedNewtypeDeriving -NoGeneralisedNewtypeDeriving -ImplicitParams -NoImplicitParams -ImplicitPrelude -NoImplicitPrelude -ImportQualifiedPost -NoImportQualifiedPost -ImpredicativeTypes -NoImpredicativeTypes -IncoherentInstances -NoIncoherentInstances -TypeFamilyDependencies -NoTypeFamilyDependencies -InstanceSigs -NoInstanceSigs -ApplicativeDo -NoApplicativeDo -InterruptibleFFI -NoInterruptibleFFI -NoJavaScriptFFI -KindSignatures -NoKindSignatures -LambdaCase -NoLambdaCase -LexicalNegation -NoLexicalNegation -LiberalTypeSynonyms -NoLiberalTypeSynonyms -LinearTypes -NoLinearTypes -MagicHash -NoMagicHash -MonadComprehensions -NoMonadComprehensions -MonoLocalBinds -NoMonoLocalBinds -DeepSubsumption -NoDeepSubsumption -MonomorphismRestriction -NoMonomorphismRestriction -MultiParamTypeClasses -NoMultiParamTypeClasses -MultiWayIf -NoMultiWayIf -NumericUnderscores -NoNumericUnderscores -NPlusKPatterns -NoNPlusKPatterns -NamedFieldPuns -NoNamedFieldPuns -NamedWildCards -NoNamedWildCards -NegativeLiterals -NoNegativeLiterals -HexFloatLiterals -NoHexFloatLiterals -NondecreasingIndentation -NoNondecreasingIndentation -NullaryTypeClasses -NoNullaryTypeClasses -NumDecimals -NoNumDecimals -OverlappingInstances -NoOverlappingInstances -OverloadedLabels -NoOverloadedLabels -OverloadedLists -NoOverloadedLists -OverloadedStrings -NoOverloadedStrings -PackageImports -NoPackageImports -ParallelArrays -NoParallelArrays -ParallelListComp -NoParallelListComp -PartialTypeSignatures -NoPartialTypeSignatures -PatternGuards -NoPatternGuards -PatternSignatures -NoPatternSignatures -PatternSynonyms -NoPatternSynonyms -PolyKinds -NoPolyKinds -PolymorphicComponents -NoPolymorphicComponents -QuantifiedConstraints -NoQuantifiedConstraints -PostfixOperators -NoPostfixOperators -QuasiQuotes -NoQuasiQuotes -QualifiedDo -NoQualifiedDo -Rank2Types -NoRank2Types -RankNTypes -NoRankNTypes -RebindableSyntax -NoRebindableSyntax -OverloadedRecordDot -NoOverloadedRecordDot -OverloadedRecordUpdate -NoOverloadedRecordUpdate -RecordPuns -NoRecordPuns -RecordWildCards -NoRecordWildCards -RecursiveDo -NoRecursiveDo -RelaxedLayout -NoRelaxedLayout -RelaxedPolyRec -NoRelaxedPolyRec -RoleAnnotations -NoRoleAnnotations -ScopedTypeVariables -NoScopedTypeVariables -StandaloneDeriving -NoStandaloneDeriving -StarIsType -NoStarIsType -StaticPointers -NoStaticPointers -Strict -NoStrict -StrictData -NoStrictData -TemplateHaskell -NoTemplateHaskell -TemplateHaskellQuotes -NoTemplateHaskellQuotes -StandaloneKindSignatures -NoStandaloneKindSignatures -TraditionalRecordSyntax -NoTraditionalRecordSyntax -TransformListComp -NoTransformListComp -TupleSections -NoTupleSections -TypeAbstractions -NoTypeAbstractions -TypeApplications -NoTypeApplications -TypeData -NoTypeData -TypeInType -NoTypeInType -TypeFamilies -NoTypeFamilies -TypeOperators -NoTypeOperators -TypeSynonymInstances -NoTypeSynonymInstances -UnboxedTuples -NoUnboxedTuples -UnboxedSums -NoUnboxedSums -UndecidableInstances -NoUndecidableInstances -UndecidableSuperClasses -NoUndecidableSuperClasses -UnicodeSyntax -NoUnicodeSyntax -UnliftedDatatypes -NoUnliftedDatatypes -UnliftedFFITypes -NoUnliftedFFITypes -UnliftedNewtypes -NoUnliftedNewtypes -ViewPatterns -NoViewPatterns -''; + Haskell98 + Haskell2010 + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >=0) '' + GHC2021 + '' + pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.10" >=0) '' + GHC2024 + ''}Unsafe + Trustworthy + Safe + AllowAmbiguousTypes + NoAllowAmbiguousTypes + AlternativeLayoutRule + NoAlternativeLayoutRule + AlternativeLayoutRuleTransitional + NoAlternativeLayoutRuleTransitional + Arrows + NoArrows + AutoDeriveTypeable + NoAutoDeriveTypeable + BangPatterns + NoBangPatterns + BinaryLiterals + NoBinaryLiterals + CApiFFI + NoCApiFFI + CPP + NoCPP + CUSKs + NoCUSKs + ConstrainedClassMethods + NoConstrainedClassMethods + ConstraintKinds + NoConstraintKinds + DataKinds + NoDataKinds + DatatypeContexts + NoDatatypeContexts + DefaultSignatures + NoDefaultSignatures + DeriveAnyClass + NoDeriveAnyClass + DeriveDataTypeable + NoDeriveDataTypeable + DeriveFoldable + NoDeriveFoldable + DeriveFunctor + NoDeriveFunctor + DeriveGeneric + NoDeriveGeneric + DeriveLift + NoDeriveLift + DeriveTraversable + NoDeriveTraversable + DerivingStrategies + NoDerivingStrategies + DerivingVia + NoDerivingVia + DisambiguateRecordFields + NoDisambiguateRecordFields + DoAndIfThenElse + NoDoAndIfThenElse + BlockArguments + NoBlockArguments + DoRec + NoDoRec + DuplicateRecordFields + NoDuplicateRecordFields + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >=0) '' + FieldSelectors + NoFieldSelectors + ''}EmptyCase + NoEmptyCase + EmptyDataDecls + NoEmptyDataDecls + EmptyDataDeriving + NoEmptyDataDeriving + ExistentialQuantification + NoExistentialQuantification + ExplicitForAll + NoExplicitForAll + ExplicitNamespaces + NoExplicitNamespaces + ExtendedDefaultRules + NoExtendedDefaultRules + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.8" >=0) '' + ExtendedLiterals + NoExtendedLiterals + ''}FlexibleContexts + NoFlexibleContexts + FlexibleInstances + NoFlexibleInstances + ForeignFunctionInterface + NoForeignFunctionInterface + FunctionalDependencies + NoFunctionalDependencies + GADTSyntax + NoGADTSyntax + GADTs + NoGADTs + GHCForeignImportPrim + NoGHCForeignImportPrim + GeneralizedNewtypeDeriving + NoGeneralizedNewtypeDeriving + GeneralisedNewtypeDeriving + NoGeneralisedNewtypeDeriving + ImplicitParams + NoImplicitParams + ImplicitPrelude + NoImplicitPrelude + ImportQualifiedPost + NoImportQualifiedPost + ImpredicativeTypes + NoImpredicativeTypes + IncoherentInstances + NoIncoherentInstances + TypeFamilyDependencies + NoTypeFamilyDependencies + InstanceSigs + NoInstanceSigs + ApplicativeDo + NoApplicativeDo + InterruptibleFFI + NoInterruptibleFFI + ${pkgs.lib.optionalString (pkgs.stdenv.targetPlatform.isGhcjs || builtins.compareVersions ghc.version "9.8" <0) '' + JavaScriptFFI + ''}NoJavaScriptFFI + KindSignatures + NoKindSignatures + LambdaCase + NoLambdaCase + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.0" >=0) '' + LexicalNegation + NoLexicalNegation + ''}LiberalTypeSynonyms + NoLiberalTypeSynonyms + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >=0) '' + LinearTypes + NoLinearTypes + '' + pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.10" >=0) '' + ListTuplePuns + NoListTuplePuns + ''}MagicHash + NoMagicHash + MonadComprehensions + NoMonadComprehensions + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" <0) '' + MonadFailDesugaring + NoMonadFailDesugaring + ''}MonoLocalBinds + NoMonoLocalBinds + ${if (builtins.compareVersions ghc.version "9.2" >=0) + then '' + DeepSubsumption + NoDeepSubsumption + '' + else '' + MonoPatBinds + NoMonoPatBinds + '' + }MonomorphismRestriction + NoMonomorphismRestriction + MultiParamTypeClasses + NoMultiParamTypeClasses + MultiWayIf + NoMultiWayIf + NumericUnderscores + NoNumericUnderscores + NPlusKPatterns + NoNPlusKPatterns + NamedFieldPuns + NoNamedFieldPuns + NamedWildCards + NoNamedWildCards + NegativeLiterals + NoNegativeLiterals + HexFloatLiterals + NoHexFloatLiterals + NondecreasingIndentation + NoNondecreasingIndentation + NullaryTypeClasses + NoNullaryTypeClasses + NumDecimals + NoNumDecimals + OverlappingInstances + NoOverlappingInstances + OverloadedLabels + NoOverloadedLabels + OverloadedLists + NoOverloadedLists + OverloadedStrings + NoOverloadedStrings + PackageImports + NoPackageImports + ParallelArrays + NoParallelArrays + ParallelListComp + NoParallelListComp + PartialTypeSignatures + NoPartialTypeSignatures + PatternGuards + NoPatternGuards + PatternSignatures + NoPatternSignatures + PatternSynonyms + NoPatternSynonyms + PolyKinds + NoPolyKinds + PolymorphicComponents + NoPolymorphicComponents + QuantifiedConstraints + NoQuantifiedConstraints + PostfixOperators + NoPostfixOperators + QuasiQuotes + NoQuasiQuotes + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >=0) '' + QualifiedDo + NoQualifiedDo + ''}Rank2Types + NoRank2Types + RankNTypes + NoRankNTypes + RebindableSyntax + NoRebindableSyntax + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >=0) '' + OverloadedRecordDot + NoOverloadedRecordDot + OverloadedRecordUpdate + NoOverloadedRecordUpdate + ''}RecordPuns + NoRecordPuns + RecordWildCards + NoRecordWildCards + RecursiveDo + NoRecursiveDo + RelaxedLayout + NoRelaxedLayout + RelaxedPolyRec + NoRelaxedPolyRec + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.10" >=0) '' + RequiredTypeArguments + NoRequiredTypeArguments + ''}RoleAnnotations + NoRoleAnnotations + ScopedTypeVariables + NoScopedTypeVariables + StandaloneDeriving + NoStandaloneDeriving + StarIsType + NoStarIsType + StaticPointers + NoStaticPointers + Strict + NoStrict + StrictData + NoStrictData + TemplateHaskell + NoTemplateHaskell + TemplateHaskellQuotes + NoTemplateHaskellQuotes + StandaloneKindSignatures + NoStandaloneKindSignatures + TraditionalRecordSyntax + NoTraditionalRecordSyntax + TransformListComp + NoTransformListComp + TupleSections + NoTupleSections + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.8" >=0) '' + TypeAbstractions + NoTypeAbstractions + ''}TypeApplications + NoTypeApplications + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.6" <0) '' + TypeData + NoTypeData + ''}TypeInType + NoTypeInType + TypeFamilies + NoTypeFamilies + TypeOperators + NoTypeOperators + TypeSynonymInstances + NoTypeSynonymInstances + UnboxedTuples + NoUnboxedTuples + UnboxedSums + NoUnboxedSums + UndecidableInstances + NoUndecidableInstances + UndecidableSuperClasses + NoUndecidableSuperClasses + UnicodeSyntax + NoUnicodeSyntax + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >=0) '' + UnliftedDatatypes + NoUnliftedDatatypes + ''}UnliftedFFITypes + NoUnliftedFFITypes + UnliftedNewtypes + NoUnliftedNewtypes + ViewPatterns + NoViewPatterns + ''; } From 95f4822190848c7e57533fe7c192f164f237f6a1 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 26 Apr 2024 14:41:38 +1200 Subject: [PATCH 73/82] Add test for lib/supported-langauges.nix --- lib/supported-languages.nix | 2 +- test/default.nix | 1 + test/supported-langauges/default.nix | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/supported-langauges/default.nix diff --git a/lib/supported-languages.nix b/lib/supported-languages.nix index 3d633db080..d3318627d5 100644 --- a/lib/supported-languages.nix +++ b/lib/supported-languages.nix @@ -275,7 +275,7 @@ evalPackages.writeTextFile { NoTypeAbstractions ''}TypeApplications NoTypeApplications - ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.6" <0) '' + ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.6" >=0) '' TypeData NoTypeData ''}TypeInType diff --git a/test/default.nix b/test/default.nix index 9b8925ae1d..abccf8f7b3 100644 --- a/test/default.nix +++ b/test/default.nix @@ -220,6 +220,7 @@ let annotations = callTest ./annotations { inherit util; }; cabal-project-nix-path = callTest ./cabal-project-nix-path {}; plugin = callTest ./plugin {}; + supported-languages = callTest ./supported-langauges {}; unit = unitTests; }; diff --git a/test/supported-langauges/default.nix b/test/supported-langauges/default.nix new file mode 100644 index 0000000000..60b81912aa --- /dev/null +++ b/test/supported-langauges/default.nix @@ -0,0 +1,28 @@ +{ stdenv, pkgs, lib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }: + +let + ghc = buildPackages.haskell-nix.compiler.${compiler-nix-name}; + + supported-langauges = import ../../lib/supported-languages.nix { + inherit pkgs evalPackages ghc; + }; + +in recurseIntoAttrs { + check = stdenv.mkDerivation { + name = "support-languages-check"; + + buildCommand = '' + expected=$(mktemp) + ${ghc}/bin/${ghc.targetPrefix}ghc --supported-languages >$expected + + echo 'diff -u $expected ${supported-langauges}' + diff -u $expected ${supported-langauges} + + touch $out + ''; + + meta = rec { + platforms = lib.platforms.all; + }; + }; +} From 45770bc9b020d4731f50f41cc71028833ac76986 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 26 Apr 2024 20:22:08 +1200 Subject: [PATCH 74/82] Remove tabs --- lib/supported-languages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/supported-languages.nix b/lib/supported-languages.nix index d3318627d5..7166fb4dc3 100644 --- a/lib/supported-languages.nix +++ b/lib/supported-languages.nix @@ -142,7 +142,7 @@ evalPackages.writeTextFile { NoLinearTypes '' + pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.10" >=0) '' ListTuplePuns - NoListTuplePuns + NoListTuplePuns ''}MagicHash NoMagicHash MonadComprehensions @@ -243,7 +243,7 @@ evalPackages.writeTextFile { NoRelaxedPolyRec ${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.10" >=0) '' RequiredTypeArguments - NoRequiredTypeArguments + NoRequiredTypeArguments ''}RoleAnnotations NoRoleAnnotations ScopedTypeVariables From 021122f78a1dd4692590b9201c40cb6ac8d3978a Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Mon, 29 Apr 2024 11:21:34 +1200 Subject: [PATCH 75/82] Exclude packages versions found in hackage from dummy-ghc --- lib/call-cabal-project-to-nix.nix | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 7220ed5988..eee24e75d5 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -379,9 +379,9 @@ let if builtins.compareVersions ghc.version "9.10" >= 0 then ["ghc-internal" "ghc-prim"] else ["ghc-bignum" "ghc-prim" "rts"]; - # binary.depends = ["array" "base" "bytestring" "containers"]; - # bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; - # containers.depends = ["array" "base" "deepseq" "template-haskell"]; + binary.depends = ["array" "base" "bytestring" "containers"]; + bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; + containers.depends = ["array" "base" "deepseq" "template-haskell"]; deepseq.depends = ["array" "base" "ghc-prim"]; directory.depends = ["base" "filepath" "os-string" "time" "unix" "Win32"]; exceptions.depends = ["base" "mtl" "stm" "template-haskell" "transformers"]; @@ -403,7 +403,7 @@ let integer-gmp.depends = ["base" "ghc-bignum" "ghc-internal" "ghc-prim"]; mtl.depends = ["base" "transformers"]; os-string.depends = ["base" "bytestring" "deepseq" "exceptions" "template-haskell"]; - # parsec.depends = ["base" "bytestring" "mtl" "text"]; + parsec.depends = ["base" "bytestring" "mtl" "text"]; pretty.depends = ["base" "deepseq" "ghc-prim"]; process.depends = ["base" "deepseq" "directory" "filepath" "unix" "Win32"]; rts.depends = []; @@ -411,7 +411,7 @@ let stm.depends = ["array" "base"]; template-haskell.depends = ["base" "ghc-boot-th" "ghc-prim" "pretty"]; terminfo.depends = ["base"]; - # text.depends = ["array" "base" "binary" "bytestring" "deepseq" "ghc-prim" "template-haskell"]; + text.depends = ["array" "base" "binary" "bytestring" "deepseq" "ghc-prim" "template-haskell"]; time.depends = ["base" "deepseq" "Win32"]; transformers.depends = ["base"]; xhtml.depends = ["base"]; @@ -453,33 +453,27 @@ let ${if ghc-pkgs.${name} ? version then '' VER_${varname name}="${ghc-pkgs.${name}.version}" - PKGS+=" ${name}" - LAST_PKG="${name}" '' else '' if [ -f ${ghcSrc}/libraries/${name}/${name}.cabal ]; then VER_${varname name}=$(cat ${ghcSrc}/libraries/${name}/${name}.cabal | tr "\n" "\r" | sed -E -e 's/.*\r[Vv]ersion:( |\r|\t)*([0-9.]*).*/\2/') - PKGS+=" ${name}" - LAST_PKG="${name}" elif [ -f ${ghcSrc}/libraries/Cabal/${name}/${name}.cabal ]; then VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/Cabal/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - PKGS+=" ${name}" elif [ -f ${ghcSrc}/libraries/${name}/${name}/${name}.cabal ]; then VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/${name}/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - PKGS+=" ${name}" elif [ -f ${ghcSrc}/${name}/${name}.cabal ]; then VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - PKGS+=" ${name}" elif [ -f ${ghcSrc}/${name}/${name}.cabal.in ]; then VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/${name}/${name}.cabal.in | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - PKGS+=" ${name}" elif [ -f ${ghcSrc}/libraries/${name}/${name}.cabal.in ]; then VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal.in | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - PKGS+=" ${name}" - LAST_PKG="${name}" fi '' } + if [[ ! "${pkgs.lib.concatStringsSep " " (builtins.attrNames pkgs.haskell-nix.hackage.${name})}" =~ "$VER_${varname name}" ]]; then + PKGS+=" ${name}" + LAST_PKG="${name}" + fi '') (builtins.attrNames ghc-pkgs)) } for pkg in $PKGS; do From aa7b1b53075a9a9955d2d4594496a02416b30240 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Mon, 29 Apr 2024 12:05:40 +1200 Subject: [PATCH 76/82] Exclude packages versions found in hackage from dummy-ghc --- lib/call-cabal-project-to-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index eee24e75d5..903a25f986 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -470,7 +470,7 @@ let fi '' } - if [[ ! "${pkgs.lib.concatStringsSep " " (builtins.attrNames pkgs.haskell-nix.hackage.${name})}" =~ "$VER_${varname name}" ]]; then + if [[ ! "${pkgs.lib.concatStringsSep " " (builtins.attrNames pkgs.haskell-nix.hackage.${name} or {})}" =~ "$VER_${varname name}" ]]; then PKGS+=" ${name}" LAST_PKG="${name}" fi From 5c16f91b5771d1f9cf311c885953a2905d9e7b7d Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Mon, 29 Apr 2024 18:46:04 +1200 Subject: [PATCH 77/82] Use cabal2json to inspect ghc .cabal files --- lib/call-cabal-project-to-nix.nix | 227 +++++++++++++++--------------- 1 file changed, 111 insertions(+), 116 deletions(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 903a25f986..d925cdc3c3 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -359,140 +359,135 @@ let ''; }; - ghc-pkgs = { - # This list was derived from the output of: - # for a in $(ghc-pkg list | tr '\n' ' ' | sed -e 's| *| |g' -e 's|^[^ ]*||' -e 's|-[0-9][^ ]*||g' -e 's| (| |'); do ghc-pkg field $a depends | tr '\n' ' ' | sed -e 's| *| |g' -e 's|^depends: ||' -e 's|-[0-9][^ ]*||g' -e 's| *$||' -e 's| |" "|g' -e "s|^| $a.depends = [\"|" -e 's|$|"];|'; echo; done - # If a package is not included in the GHC source it will be left out. - # Include conditional code if: - # * A dependency is removed - # * A dependency to an already existing package is added - # Cabal.depends = - # if builtins.compareVersions ghc.version "9.10" >= 0 - # then ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "time" "transformers" "unix"] - # else ["Cabal-syntax" "array" "base" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "process" "text" "time" "transformers" "unix"]; - # Cabal-syntax.depends = - # if builtins.compareVersions ghc.version "9.10" >= 0 - # then ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers"] - # else ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "mtl" "parsec" "pretty" "text" "time" "transformers" "unix"]; - array.depends = ["base"]; - base.depends = - if builtins.compareVersions ghc.version "9.10" >= 0 - then ["ghc-internal" "ghc-prim"] - else ["ghc-bignum" "ghc-prim" "rts"]; - binary.depends = ["array" "base" "bytestring" "containers"]; - bytestring.depends = ["base" "deepseq" "ghc-prim" "template-haskell"]; - containers.depends = ["array" "base" "deepseq" "template-haskell"]; - deepseq.depends = ["array" "base" "ghc-prim"]; - directory.depends = ["base" "filepath" "os-string" "time" "unix" "Win32"]; - exceptions.depends = ["base" "mtl" "stm" "template-haskell" "transformers"]; - filepath.depends = ["base" "bytestring" "deepseq" "exceptions" "os-string" "template-haskell"]; - ghc.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "directory" "exceptions" "filepath" "ghc-boot" "ghc-heap" "ghci" "hpc" "process" "semaphore-compat" "stm" "template-haskell" "terminfo" "time" "transformers" "unix" "Win32"]; - ghc-bignum.depends = ["ghc-prim"]; - ghc-boot.depends = ["base" "binary" "bytestring" "containers" "deepseq" "directory" "filepath" "ghc-boot-th" "ghc-platform" "unix"]; - ghc-boot-th.depends = ["base"]; - ghc-compact.depends = ["base" "bytestring" "ghc-prim"]; - ghc-experimental.depends = ["base" "ghc-internal" "ghc-prim"]; - ghc-heap.depends = ["base" "containers" "ghc-internal" "ghc-prim" "rts"]; - ghc-internal.depends = ["ghc-bignum" "ghc-prim" "rts"]; - ghc-platform.depends = ["base"]; - ghc-prim.depends = ["rts"]; - ghc-toolchain.depends = ["base" "directory" "filepath" "ghc-platform" "process" "text" "transformers"]; - ghci.depends = ["array" "base" "binary" "bytestring" "containers" "deepseq" "filepath" "ghc-boot" "ghc-heap" "ghc-prim" "rts" "template-haskell" "transformers" "unix"]; - haskeline.depends = ["base" "bytestring" "containers" "directory" "exceptions" "filepath" "process" "stm" "terminfo" "transformers" "unix" "Win32"]; - hpc.depends = ["base" "containers" "deepseq" "directory" "filepath" "time"]; - integer-gmp.depends = ["base" "ghc-bignum" "ghc-internal" "ghc-prim"]; - mtl.depends = ["base" "transformers"]; - os-string.depends = ["base" "bytestring" "deepseq" "exceptions" "template-haskell"]; - parsec.depends = ["base" "bytestring" "mtl" "text"]; - pretty.depends = ["base" "deepseq" "ghc-prim"]; - process.depends = ["base" "deepseq" "directory" "filepath" "unix" "Win32"]; - rts.depends = []; - semaphore-compat.depends = ["base" "exceptions" "unix" "Win32"]; - stm.depends = ["array" "base"]; - template-haskell.depends = ["base" "ghc-boot-th" "ghc-prim" "pretty"]; - terminfo.depends = ["base"]; - text.depends = ["array" "base" "binary" "bytestring" "deepseq" "ghc-prim" "template-haskell"]; - time.depends = ["base" "deepseq" "Win32"]; - transformers.depends = ["base"]; - xhtml.depends = ["base"]; - - ghc.version = ghc.version; - ghc-boot.version = ghc.version; - ghc-boot-th.version = ghc.version; - ghc-heap.version = ghc.version; - ghci.version = ghc.version; - } // (if pkgs.stdenv.targetPlatform.isWindows - then { Win32.depends = ["base" "filepath"]; } - else { unix.depends = ["base" "bytestring" "filepath" "os-string" "time"]; } - ) // pkgs.lib.optionalAttrs (builtins.compareVersions ghc.version "9.2" >= 0) { - system-cxx-std-lib.depends = []; - system-cxx-std-lib.version = "1.0"; - }; - - # Dummy `ghc-pkg` that uses the captured output - dummy-ghc-pkg = evalPackages.writeTextFile { - name = "dummy-pkg-" + ghc.name; - executable = true; - destination = "/bin/${ghc.targetPrefix}ghc-pkg"; - text = '' - #!${evalPackages.runtimeShell} - case "$*" in - --version) - echo "GHC package manager version ${ghc.version}" - ;; - ${pkgs.lib.optionalString (ghc.targetPrefix == "js-unknown-ghcjs-") '' - --numeric-ghcjs-version) - echo "${ghc.version}" - ;; - ''} - 'dump --global -v0') + ghc-pkgs = [ + "Cabal" + "Cabal-syntax" + "array" + "base" + "binary" + "bytestring" + "containers" + "deepseq" + "directory" + "exceptions" + "filepath" + "ghc" + "ghc-bignum" + "ghc-boot" + "ghc-boot-th" + "ghc-compact" + "ghc-experimental" + "ghc-heap" + "ghc-internal" + "ghc-platform" + "ghc-prim" + "ghc-toolchain" + "ghci" + "haskeline" + "hpc" + "integer-gmp" + "mtl" + "os-string" + "parsec" + "pretty" + "process" + "rts" + "semaphore-compat" + "stm" + "template-haskell" + "terminfo" + "text" + "time" + "transformers" + "xhtml" + ] ++ (if pkgs.stdenv.targetPlatform.isWindows + then [ "Win32" ] + else [ "unix" ] + ); + + dummy-ghc-pkg-dump = evalPackages.runCommand "dummy-ghc-pkg-dump" { + nativeBuildInputs = [ + evalPackages.haskell-nix.nix-tools-unchecked.exes.cabal2json + evalPackages.jq + ]; + } (let varname = x: builtins.replaceStrings ["-"] ["_"] x; in '' PKGS="" ${pkgs.lib.concatStrings - (builtins.map (name: let varname = x: builtins.replaceStrings ["-"] ["_"] x; in '' - DEPS_${varname name}="${builtins.concatStringsSep " " ghc-pkgs.${name}.depends}" - ${if ghc-pkgs.${name} ? version - then '' - VER_${varname name}="${ghc-pkgs.${name}.version}" - '' - else '' - if [ -f ${ghcSrc}/libraries/${name}/${name}.cabal ]; then - VER_${varname name}=$(cat ${ghcSrc}/libraries/${name}/${name}.cabal | tr "\n" "\r" | sed -E -e 's/.*\r[Vv]ersion:( |\r|\t)*([0-9.]*).*/\2/') - elif [ -f ${ghcSrc}/libraries/Cabal/${name}/${name}.cabal ]; then - VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/Cabal/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - elif [ -f ${ghcSrc}/libraries/${name}/${name}/${name}.cabal ]; then - VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/${name}/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - elif [ -f ${ghcSrc}/${name}/${name}.cabal ]; then - VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/${name}/${name}.cabal | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - elif [ -f ${ghcSrc}/${name}/${name}.cabal.in ]; then - VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/${name}/${name}.cabal.in | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - elif [ -f ${ghcSrc}/libraries/${name}/${name}.cabal.in ]; then - VER_${varname name}=$(grep -i '^version:' ${ghcSrc}/libraries/${name}/${name}.cabal.in | sed 's|^[Vv]ersion:[ \t]*\(.*\)$|\1|') - fi - '' - } - if [[ ! "${pkgs.lib.concatStringsSep " " (builtins.attrNames pkgs.haskell-nix.hackage.${name} or {})}" =~ "$VER_${varname name}" ]]; then + (builtins.map (name: '' + cabal_file="" + if [ -f ${ghcSrc}/libraries/${name}/${name}.cabal ]; then + cabal_file=${ghcSrc}/libraries/${name}/${name}.cabal + elif [ -f ${ghcSrc}/libraries/Cabal/${name}/${name}.cabal ]; then + cabal_file=${ghcSrc}/libraries/Cabal/${name}/${name}.cabal + elif [ -f ${ghcSrc}/libraries/${name}/${name}/${name}.cabal ]; then + cabal_file=${ghcSrc}/libraries/${name}/${name}/${name}.cabal + elif [ -f ${ghcSrc}/compiler/${name}.cabal ]; then + cabal_file=${ghcSrc}/compiler/${name}.cabal + elif [ -f ${ghcSrc}/compiler/${name}.cabal.in ]; then + cabal_file=${ghcSrc}/compiler/${name}.cabal.in + elif [ -f ${ghcSrc}/libraries/${name}/${name}.cabal.in ]; then + cabal_file=${ghcSrc}/libraries/${name}/${name}.cabal.in + fi + if [[ "$cabal_file" != "" ]]; then + fixed_cabal_file=$(mktemp) + cat $cabal_file | sed -e 's/@ProjectVersionMunged@/${ghc.version}/g' -e 's/default: *@[A-Za-z0-9]*@/default: False/g' > $fixed_cabal_file + json_cabal_file=$(mktemp) + cabal2json $fixed_cabal_file > $json_cabal_file + EXPOSED_MODULES_${varname name}="$(jq -r '.library."exposed-modules"[]|select(type=="array")[]' $json_cabal_file | tr '\n' ' ')" + DEPS_${varname name}="$(jq -r '.library."build-depends"[]|select(type=="array")[]' $json_cabal_file | sed 's/^\([A-Za-z0-9-]*\).*$/\1/g' | tr '\n' ' ')" + VER_${varname name}="$(jq -r '.version' $json_cabal_file)" PKGS+=" ${name}" LAST_PKG="${name}" fi - '') (builtins.attrNames ghc-pkgs)) + '') ghc-pkgs) } + ${ # There is not .cabal file for system-cxx-std-lib + pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.2" >= 0) ( + let name="system-cxx-std-lib"; in '' + EXPOSED_MODULES_${varname name}="" + DEPS_${varname name}="" + VER_${varname name}="1.0" + PKGS+=" ${name}" + LAST_PKG="${name}" + '')} for pkg in $PKGS; do varname="$(echo $pkg | tr "-" "_")" ver="VER_$varname" + exposed_mods="EXPOSED_MODULES_$varname" deps="DEPS_$varname" - echo "name: $pkg" - echo "version: ''${!ver}" - echo "depends:" + echo "name: $pkg" >> $out + echo "version: ''${!ver}" >> $out + echo "exposed-modules: ''${!exposed_mods}" >> $out + echo "depends:" >> $out for dep in ''${!deps}; do ver_dep="VER_$(echo $dep | tr "-" "_")" if [[ "''${!ver_dep}" != "" ]]; then - echo " $dep-''${!ver_dep}" + echo " $dep-''${!ver_dep}" >> $out fi done if [[ "$pkg" != "$LAST_PKG" ]]; then - echo '---' + echo '---' >> $out fi done + ''); + # Dummy `ghc-pkg` that uses the captured output + dummy-ghc-pkg = evalPackages.writeTextFile { + name = "dummy-pkg-" + ghc.name; + executable = true; + destination = "/bin/${ghc.targetPrefix}ghc-pkg"; + text = '' + #!${evalPackages.runtimeShell} + case "$*" in + --version) + echo "GHC package manager version ${ghc.version}" + ;; + ${pkgs.lib.optionalString (ghc.targetPrefix == "js-unknown-ghcjs-") '' + --numeric-ghcjs-version) + echo "${ghc.version}" + ;; + ''} + 'dump --global -v0') + cat ${dummy-ghc-pkg-dump} ;; *) echo "Unknown argument '$*'. " >&2 From c09a6e69875ab41f9fd69649b7f7ad2709bc3a1f Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Mon, 29 Apr 2024 19:25:46 +1200 Subject: [PATCH 78/82] Include conditional dependencies (unix and Win32) --- lib/call-cabal-project-to-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index d925cdc3c3..30ad1df383 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -434,7 +434,7 @@ let json_cabal_file=$(mktemp) cabal2json $fixed_cabal_file > $json_cabal_file EXPOSED_MODULES_${varname name}="$(jq -r '.library."exposed-modules"[]|select(type=="array")[]' $json_cabal_file | tr '\n' ' ')" - DEPS_${varname name}="$(jq -r '.library."build-depends"[]|select(type=="array")[]' $json_cabal_file | sed 's/^\([A-Za-z0-9-]*\).*$/\1/g' | tr '\n' ' ')" + DEPS_${varname name}="$(jq -r '.library."build-depends"[]|select(type=="array")[],select(type=="object").then[]' $json_cabal_file | sed 's/^\([A-Za-z0-9-]*\).*$/\1/g' | sort -u | tr '\n' ' ')" VER_${varname name}="$(jq -r '.version' $json_cabal_file)" PKGS+=" ${name}" LAST_PKG="${name}" From 17b97039548b6ad4d1afca0e8b9b5bc228175474 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Mon, 29 Apr 2024 22:33:57 +1200 Subject: [PATCH 79/82] Fix for ghc 9.11 --- lib/call-cabal-project-to-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 30ad1df383..1927f6372c 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -430,7 +430,7 @@ let fi if [[ "$cabal_file" != "" ]]; then fixed_cabal_file=$(mktemp) - cat $cabal_file | sed -e 's/@ProjectVersionMunged@/${ghc.version}/g' -e 's/default: *@[A-Za-z0-9]*@/default: False/g' > $fixed_cabal_file + cat $cabal_file | sed -e 's/@ProjectVersionMunged@/${ghc.version}/g' -e 's/default: *@[A-Za-z0-9]*@/default: False/g' -e 's/@Suffix@//g' > $fixed_cabal_file json_cabal_file=$(mktemp) cabal2json $fixed_cabal_file > $json_cabal_file EXPOSED_MODULES_${varname name}="$(jq -r '.library."exposed-modules"[]|select(type=="array")[]' $json_cabal_file | tr '\n' ' ')" From 1dba456e68274072ef6c1f8520d1a8fae11dd2cb Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Mon, 29 Apr 2024 23:18:37 +1200 Subject: [PATCH 80/82] Update head.hackage --- test/cabal.project.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cabal.project.local b/test/cabal.project.local index f5cb0354ed..174402f804 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -24,7 +24,7 @@ repository head.hackage.ghc.haskell.org f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-L40SN6Nd071vEMvn5U0+PCKQvD/1U8WPwepbMrV94FA= + --sha256: sha256-dx4WtCafVcu1+IlaK1ABcqQ1UummqTN8HRo3svRdTOE= repository ghcjs-overlay url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/ed91ac93832fdfc50471ab8df13b8174e91b35ed From 3833c4e66b455c40af74db5d9aa67ce8864840b6 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 30 Apr 2024 11:20:24 +1200 Subject: [PATCH 81/82] Revert workarounds for ghc <8.11 (may not be needed now) --- build.nix | 8 +------- test/cabal-doctests/cabal-doctests-test.cabal | 2 +- test/cabal-simple-debug/cabal-simple.cabal | 2 +- test/cabal-simple-prof/cabal-simple.cabal | 2 +- test/cabal-source-repo-comments/cabal.project | 1 - test/cabal-sublib/cabal-sublib.cabal | 2 +- test/cabal.project.local | 10 ++-------- test/sublib-docs/sublib-docs.cabal | 2 +- test/th-dlls/cabal.project | 2 -- 9 files changed, 8 insertions(+), 23 deletions(-) diff --git a/build.nix b/build.nix index 0aea21fc05..2bf29be8de 100644 --- a/build.nix +++ b/build.nix @@ -26,13 +26,7 @@ in rec { tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) ( pkgs.recurseIntoAttrs ({ - cabal-latest = tool compiler-nix-name "cabal" { - inherit evalPackages; - cabalProjectLocal = '' - if impl(ghc <8.11) - constraints: os-string < 2.0 - ''; - }; + cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; }; } // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) { hlint-latest = tool compiler-nix-name "hlint" { inherit evalPackages; diff --git a/test/cabal-doctests/cabal-doctests-test.cabal b/test/cabal-doctests/cabal-doctests-test.cabal index f6c2617742..36eb9ee6df 100644 --- a/test/cabal-doctests/cabal-doctests-test.cabal +++ b/test/cabal-doctests/cabal-doctests-test.cabal @@ -16,7 +16,7 @@ library other-modules: Paths_cabal_doctests_test build-depends: base >=4.7 && <5, - aeson > 2 + aeson default-language: Haskell2010 test-suite doctests diff --git a/test/cabal-simple-debug/cabal-simple.cabal b/test/cabal-simple-debug/cabal-simple.cabal index ddcfac27b2..aef0f956db 100644 --- a/test/cabal-simple-debug/cabal-simple.cabal +++ b/test/cabal-simple-debug/cabal-simple.cabal @@ -21,7 +21,7 @@ library build-depends: base , extra , safe - , aeson > 2 + , aeson -- hs-source-dirs: default-language: Haskell2010 diff --git a/test/cabal-simple-prof/cabal-simple.cabal b/test/cabal-simple-prof/cabal-simple.cabal index ddcfac27b2..aef0f956db 100644 --- a/test/cabal-simple-prof/cabal-simple.cabal +++ b/test/cabal-simple-prof/cabal-simple.cabal @@ -21,7 +21,7 @@ library build-depends: base , extra , safe - , aeson > 2 + , aeson -- hs-source-dirs: default-language: Haskell2010 diff --git a/test/cabal-source-repo-comments/cabal.project b/test/cabal-source-repo-comments/cabal.project index 7d6813a19c..b2fc5fc7e8 100644 --- a/test/cabal-source-repo-comments/cabal.project +++ b/test/cabal-source-repo-comments/cabal.project @@ -2,7 +2,6 @@ packages: ./ allow-newer: aeson:base, aeson:ghc-prim, aeson:template-haskell -constraints: aeson >2 source-repository-package -- Test diff --git a/test/cabal-sublib/cabal-sublib.cabal b/test/cabal-sublib/cabal-sublib.cabal index 973621b019..ef75a33b60 100644 --- a/test/cabal-sublib/cabal-sublib.cabal +++ b/test/cabal-sublib/cabal-sublib.cabal @@ -26,7 +26,7 @@ library library slib build-depends: extra , safe - , aeson > 2 + , aeson default-language: Haskell2010 executable cabal-sublib diff --git a/test/cabal.project.local b/test/cabal.project.local index 174402f804..b79d2c0412 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -7,12 +7,6 @@ if impl(ghc>=9.8) if impl(ghc > 9.9) allow-newer: *:containers -if impl(ghc <8.11) - constraints: os-string < 2.0 - -if os(osx) && impl(ghc <8.11) - constraints: text -simdutf - -- This prevents hsc2hs from causing old versions of packages from being added to plan.json allow-newer: hsc2hs:* @@ -37,10 +31,10 @@ if !impl(ghc>=9.10) && !os(ghcjs) active-repositories: hackage.haskell.org if impl(ghc>=9.10) && !os(ghcjs) - active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override if !impl(ghc>=9.10) && os(ghcjs) active-repositories: hackage.haskell.org, ghcjs-overlay:override if impl(ghc>=9.10) && os(ghcjs) - active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org, ghcjs-overlay:override + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override, ghcjs-overlay:override diff --git a/test/sublib-docs/sublib-docs.cabal b/test/sublib-docs/sublib-docs.cabal index 10bd1594bc..6ab6296258 100644 --- a/test/sublib-docs/sublib-docs.cabal +++ b/test/sublib-docs/sublib-docs.cabal @@ -29,7 +29,7 @@ library slib exposed-modules: Slib build-depends: extra , safe - , aeson > 2 + , aeson , base default-language: Haskell2010 hs-source-dirs: slib diff --git a/test/th-dlls/cabal.project b/test/th-dlls/cabal.project index b860d6c3a6..f686c244f5 100644 --- a/test/th-dlls/cabal.project +++ b/test/th-dlls/cabal.project @@ -4,5 +4,3 @@ packages: . -- See https://github.com/haskell/network/issues/550 constraints: network <3.1.3.0 || >3.1.3.0 -if os(osx) && impl(ghc<9.4) - constraints: text -simdutf From be8bc24e6c6240d8d8752eb56d538eb0dd19d1e5 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 30 Apr 2024 14:27:03 +1200 Subject: [PATCH 82/82] Don't use `:override` for head.hackage --- test/cabal.project.local | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cabal.project.local b/test/cabal.project.local index b79d2c0412..62781233a1 100644 --- a/test/cabal.project.local +++ b/test/cabal.project.local @@ -31,10 +31,10 @@ if !impl(ghc>=9.10) && !os(ghcjs) active-repositories: hackage.haskell.org if impl(ghc>=9.10) && !os(ghcjs) - active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org if !impl(ghc>=9.10) && os(ghcjs) active-repositories: hackage.haskell.org, ghcjs-overlay:override if impl(ghc>=9.10) && os(ghcjs) - active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override, ghcjs-overlay:override + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org, ghcjs-overlay:override