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"; }) )) ) diff --git a/compiler/ghc/default.nix b/compiler/ghc/default.nix index cc4fdb3b3d..de055902c7 100644 --- a/compiler/ghc/default.nix +++ b/compiler/ghc/default.nix @@ -633,6 +633,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 99864a9441..e3f682dee3 100644 --- a/flake.lock +++ b/flake.lock @@ -120,11 +120,11 @@ "ghc910X": { "flake": false, "locked": { - "lastModified": 1711543129, - "narHash": "sha256-MUI07CxYOng7ZwHnMCw0ugY3HmWo2p/f4r07CGV7OAM=", + "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" diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index 18f9e48407..1927f6372c 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -288,7 +288,9 @@ let fixedProject = replaceSourceRepos rawCabalProject; - inherit (ghc) dummy-ghc-data; + 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 { @@ -299,30 +301,54 @@ 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 '[("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.isJavaScript + 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 ${dummy-ghc-data}/ghc/libdir + echo $out/ghc/libdir ;; *) echo "Unknown argument '$*'" >&2 @@ -333,6 +359,117 @@ let ''; }; + 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: '' + 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' -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' ' ')" + 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}" + fi + '') 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" >> $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}" >> $out + fi + done + if [[ "$pkg" != "$LAST_PKG" ]]; then + echo '---' >> $out + fi + done + ''); # Dummy `ghc-pkg` that uses the captured output dummy-ghc-pkg = evalPackages.writeTextFile { name = "dummy-pkg-" + ghc.name; @@ -342,15 +479,15 @@ 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 + cat ${dummy-ghc-pkg-dump} ;; *) 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..7166fb4dc3 --- /dev/null +++ b/lib/supported-languages.nix @@ -0,0 +1,309 @@ +{pkgs, evalPackages, ghc}: +evalPackages.writeTextFile { + name = "supported-languages"; + text = '' + 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 + ''; +} 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" 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..d426599609 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 "${ghc.passthru.configured-src}/${subDir}"; nix = callCabal2Nix ghcName "${ghcName}-${pkgName}" src; }) (ghc-extra-pkgs ghc.version)) 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-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 diff --git a/test/cabal.project.local b/test/cabal.project.local index c481569919..62781233a1 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-dx4WtCafVcu1+IlaK1ABcqQ1UummqTN8HRo3svRdTOE= 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 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/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 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; + }; + }; +}