From 2478a5843d40dddc042eb4bdd0db9e30e5b69464 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Fri, 24 Jun 2022 11:07:05 -0500 Subject: [PATCH 01/11] WIP: use external nix plugin/library for splices --- default.nix | 817 +++++++++--------- haskell-overlays/default.nix | 76 +- .../dep/ghc-8.10/default.nix | 2 - .../dep/ghc-8.10/github.json | 7 - .../splices-load-save/dep/ghc-8.10/thunk.nix | 9 - .../splices-load-save/dep/ghc-8.6/default.nix | 2 - .../splices-load-save/dep/ghc-8.6/git.json | 8 - .../splices-load-save/dep/ghc-8.6/thunk.nix | 14 - .../splices-load-save/load-splices.nix | 57 -- .../splices-load-save/save-splices.nix | 38 - 10 files changed, 466 insertions(+), 564 deletions(-) delete mode 100644 haskell-overlays/splices-load-save/dep/ghc-8.10/default.nix delete mode 100644 haskell-overlays/splices-load-save/dep/ghc-8.10/github.json delete mode 100644 haskell-overlays/splices-load-save/dep/ghc-8.10/thunk.nix delete mode 100644 haskell-overlays/splices-load-save/dep/ghc-8.6/default.nix delete mode 100644 haskell-overlays/splices-load-save/dep/ghc-8.6/git.json delete mode 100644 haskell-overlays/splices-load-save/dep/ghc-8.6/thunk.nix delete mode 100644 haskell-overlays/splices-load-save/load-splices.nix delete mode 100644 haskell-overlays/splices-load-save/save-splices.nix diff --git a/default.nix b/default.nix index 76eae4e6a..3fff27233 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ { nixpkgsFunc ? import ./nixpkgs , system ? builtins.currentSystem -, config ? {} +, config ? { } , enableLibraryProfiling ? false , enableExposeAllUnfoldings ? true , enableTraceReflexEvents ? false @@ -9,231 +9,247 @@ , useTextJSString ? true # Use an implementation of "Data.Text" that uses the more performant "Data.JSString" from ghcjs-base under the hood. , __useTemplateHaskell ? true # Deprecated, just here until we remove feature from reflex and stop CIing it , iosSdkVersion ? "13.2" -, nixpkgsOverlays ? [] -, haskellOverlays ? [] # TODO deprecate -, haskellOverlaysPre ? [] +, nixpkgsOverlays ? [ ] +, haskellOverlays ? [ ] # TODO deprecate +, haskellOverlaysPre ? [ ] , haskellOverlaysPost ? haskellOverlays , hideDeprecated ? false # The moral equivalent of "-Wcompat -Werror" for using reflex-platform. }: -let iosSupport = system == "x86_64-darwin"; - androidSupport = lib.elem system [ "x86_64-linux" ]; - - xcodeVer = { - "13.2" = "11.3.1"; - }.${iosSdkVersion} or (throw "Unknown iosSdkVersion: ${iosSdkVersion}"); - - # Overlay for GHC which supports the external splices plugin - splicesEval = self: super: { - haskell = super.haskell // { - compiler = super.haskell.compiler // { - ghcSplices-8_6 = super.haskell.compiler.ghc865.overrideAttrs (drv: { - enableParallelBuilding = false; - src = nixpkgs.hackGet ./haskell-overlays/splices-load-save/dep/ghc-8.6; - # When building from the ghc git repo, ./boot must be run before configuring, whereas - # in the distribution tarball on the haskell.org downloads page, ./boot has already been - # run. - preConfigure= '' - echo ${drv.version} >VERSION - ./boot - '' + drv.preConfigure or ""; - # Our fork of 8.6 with splices includes these patches. - # Specifically, is up to date with the `ghc-8.6` branch upstream, - # which contains various backports for any potential newer 8.6.x - # release. Nixpkgs manually applied some of those backports as - # patches onto 8.6.5 ahead of such a release, but now we get them - # from the src proper. - patches = []; - }); - ghcSplices-8_10 = (super.haskell.compiler.ghc8107.override { +let + iosSupport = system == "x86_64-darwin"; + androidSupport = lib.elem system [ "x86_64-linux" ]; + + xcodeVer = { + "13.2" = "11.3.1"; + }.${iosSdkVersion} or (throw "Unknown iosSdkVersion: ${iosSdkVersion}"); + + splices-load-save-nix = ../splices-load-save.nix/default.nix; + + splices-src = import splices-load-save-nix { pkgs = nixpkgs; }; + # Overlay for GHC which supports the external splices plugin + splicesEval = self: super: { + haskell = super.haskell // { + compiler = super.haskell.compiler // { + ghcSplices-8_6 = super.haskell.compiler.ghc865.overrideAttrs (drv: { + enableParallelBuilding = false; + src = nixpkgs.hackGet "${splices-load-save-nix}"; + # When building from the ghc git repo, ./boot must be run before configuring, whereas + # in the distribution tarball on the haskell.org downloads page, ./boot has already been + # run. + preConfigure = '' + echo ${drv.version} >VERSION + ./boot + '' + drv.preConfigure or ""; + # Our fork of 8.6 with splices includes these patches. + # Specifically, is up to date with the `ghc-8.6` branch upstream, + # which contains various backports for any potential newer 8.6.x + # release. Nixpkgs manually applied some of those backports as + # patches onto 8.6.5 ahead of such a release, but now we get them + # from the src proper. + patches = [ ]; + }); + ghcSplices-8_10 = (splices-src.patchGHC (super.haskell.compiler.ghc8107)).override { }; /*(splices-src.ghc810patched.override + { # New option for GHC 8.10. Explicitly enable profiling builds enableProfiledLibs = true; - }).overrideAttrs (drv: { - src = nixpkgs.hackGet ./haskell-overlays/splices-load-save/dep/ghc-8.10; + }).overrideAttrs + (drv: { # When building from the ghc git repo, ./boot must be run before configuring, whereas # in the distribution tarball on the haskell.org downloads page, ./boot has already been # run. - preConfigure= '' + preConfigure = '' echo ${drv.version} >VERSION ./boot - '' + drv.preConfigure or ""; + '' + drv.preConfigure or " "; patches = [ - # Patch libraries/unix/config.sub to fix android build + #Patch libraries/unix/config.sub to fix android build ./nixpkgs-overlays/android-8.10-splices.patch ]; - }); + }); + */ + }; + packages = super.haskell.packages // { + ghcSplices-8_6 = super.haskell.packages.ghc865.override { + buildHaskellPackages = self.buildPackages.haskell.packages.ghcSplices-8_6; + ghc = self.buildPackages.haskell.compiler.ghcSplices-8_6; }; - packages = super.haskell.packages // { - ghcSplices-8_6 = super.haskell.packages.ghc865.override { - buildHaskellPackages = self.buildPackages.haskell.packages.ghcSplices-8_6; - ghc = self.buildPackages.haskell.compiler.ghcSplices-8_6; - }; - ghcSplices-8_10 = super.haskell.packages.ghc8107.override { - buildHaskellPackages = self.buildPackages.haskell.packages.ghcSplices-8_10; - ghc = self.buildPackages.haskell.compiler.ghcSplices-8_10; - }; + ghcSplices-8_10 = super.haskell.packages.ghc8107.override { + buildHaskellPackages = self.buildPackages.haskell.packages.ghcSplices-8_10; + ghc = self.buildPackages.haskell.compiler.ghcSplices-8_10; }; }; }; + }; - hackGetOverlay = self: super: - import ./nixpkgs-overlays/hack-get { inherit lib; } self; - - bindHaskellOverlays = self: super: { - haskell = super.haskell // { - overlays = super.haskell.overlays or {} // import ./haskell-overlays { - nixpkgs = self; - inherit (self) lib; - haskellLib = self.haskell.lib; - inherit - useFastWeak useReflexOptimizer enableLibraryProfiling enableTraceReflexEvents - useTextJSString enableExposeAllUnfoldings __useTemplateHaskell - haskellOverlaysPre - haskellOverlaysPost; - inherit ghcSavedSplices-8_6 ghcSavedSplices-8_10; - }; + hackGetOverlay = self: super: + import ./nixpkgs-overlays/hack-get { inherit lib; } self; + + bindHaskellOverlays = self: super: { + haskell = super.haskell // { + overlays = super.haskell.overlays or { } // import ./haskell-overlays { + nixpkgs = self; + inherit (self) lib; + haskellLib = self.haskell.lib; + inherit + useFastWeak useReflexOptimizer enableLibraryProfiling enableTraceReflexEvents + useTextJSString enableExposeAllUnfoldings __useTemplateHaskell + haskellOverlaysPre + haskellOverlaysPost; + inherit ghcSavedSplices-8_6 ghcSavedSplices-8_10; }; }; + }; - forceStaticLibs = self: super: { - darwin = super.darwin // { - libiconv = super.darwin.libiconv.overrideAttrs (_: - lib.optionalAttrs (self.stdenv.hostPlatform != self.stdenv.buildPlatform) { - postInstall = "rm $out/include/libcharset.h $out/include/localcharset.h"; - configureFlags = ["--disable-shared" "--enable-static"]; - }); - }; - zlib = super.zlib.override (lib.optionalAttrs - (self.stdenv.hostPlatform != self.stdenv.buildPlatform) - { static = true; shared = false; }); + forceStaticLibs = self: super: { + darwin = super.darwin // { + libiconv = super.darwin.libiconv.overrideAttrs (_: + lib.optionalAttrs (self.stdenv.hostPlatform != self.stdenv.buildPlatform) { + postInstall = " + rm $out/include/libcharset.h $out/include/localcharset.h "; + configureFlags = [ " - -disable-shared " " - -enable-static " ]; + }); }; + zlib = super.zlib.override (lib.optionalAttrs + (self.stdenv.hostPlatform != self.stdenv.buildPlatform) + { static = true; shared = false; }); + }; - mobileGhcOverlay = import ./nixpkgs-overlays/mobile-ghc { inherit lib; }; - - allCabalHashesOverlay = import ./nixpkgs-overlays/all-cabal-hashes; - - nixpkgsArgs = { - inherit system; - overlays = [ - hackGetOverlay - bindHaskellOverlays - forceStaticLibs - splicesEval - mobileGhcOverlay - allCabalHashesOverlay - (import ./nixpkgs-overlays/ghc.nix { inherit lib; }) - ] ++ nixpkgsOverlays; - config = config // { - permittedInsecurePackages = (config.permittedInsecurePackages or []) ++ [ - "webkitgtk-2.4.11" - ]; + mobileGhcOverlay = import ./nixpkgs-overlays/mobile-ghc { inherit lib; }; + + allCabalHashesOverlay = import ./nixpkgs-overlays/all-cabal-hashes; + + nixpkgsArgs = { + inherit system; + overlays = [ + hackGetOverlay + bindHaskellOverlays + forceStaticLibs + splicesEval + mobileGhcOverlay + allCabalHashesOverlay + (import ./nixpkgs-overlays/ghc.nix { inherit lib; }) + ] ++ nixpkgsOverlays; + config = config // { + permittedInsecurePackages = (config.permittedInsecurePackages or [ ]) ++ [ + " + webkitgtk-2 .4 .11 " + ]; - # XCode needed for native macOS app - # Obelisk needs it to for some reason - allowUnfree = true; - }; + # XCode needed for native macOS app + # Obelisk needs it to for some reason + allowUnfree = true; }; + }; - nixpkgs = nixpkgsFunc nixpkgsArgs; + nixpkgs = nixpkgsFunc nixpkgsArgs; - inherit (nixpkgs) lib fetchurl fetchgit fetchgitPrivate fetchFromGitHub fetchFromBitbucket; + inherit (nixpkgs) lib fetchurl fetchgit fetchgitPrivate fetchFromGitHub fetchFromBitbucket; - wasmCross = nixpkgs.hackGet ./wasm-cross; - webGhcSrc = (import (wasmCross + /webghc.nix) { inherit fetchgit; }).ghc865SplicesSrc; - nixpkgsCross = { - android = lib.mapAttrs (_: args: nixpkgsFunc (nixpkgsArgs // args)) rec { - aarch64 = { - crossSystem = lib.systems.examples.aarch64-android-prebuilt; - }; - aarch32 = { - crossSystem = lib.systems.examples.armv7a-android-prebuilt // { - # Choose an old version so it's easier to find phones to test on - sdkVer = "23"; - }; + wasmCross = nixpkgs.hackGet ./wasm-cross; + webGhcSrc = (import (wasmCross + /webghc.nix) { inherit fetchgit; }).ghc865SplicesSrc; + nixpkgsCross = { + android = lib.mapAttrs (_: args: nixpkgsFunc (nixpkgsArgs // args)) rec { + aarch64 = { + crossSystem = lib.systems.examples.aarch64-android-prebuilt; + }; + aarch32 = { + crossSystem = lib.systems.examples.armv7a-android-prebuilt // { + # Choose an old version so it's easier to find phones to test on + sdkVer = " 23 "; }; }; - ios = lib.mapAttrs (_: args: nixpkgsFunc (nixpkgsArgs // args)) rec { - simulator64 = { - crossSystem = lib.systems.examples.iphone64-simulator // { - sdkVer = iosSdkVersion; - inherit xcodeVer; - }; + }; + ios = lib.mapAttrs (_: args: nixpkgsFunc (nixpkgsArgs // args)) rec { + simulator64 = { + crossSystem = lib.systems.examples.iphone64-simulator // { + sdkVer = iosSdkVersion; + inherit xcodeVer; }; - aarch64 = { - crossSystem = lib.systems.examples.iphone64 // { - sdkVer = iosSdkVersion; - inherit xcodeVer; - }; + }; + aarch64 = { + crossSystem = lib.systems.examples.iphone64 // { + sdkVer = iosSdkVersion; + inherit xcodeVer; }; - aarch32 = { - crossSystem = lib.systems.examples.iphone32 // { - sdkVer = iosSdkVersion; - inherit xcodeVer; - }; + }; + aarch32 = { + crossSystem = lib.systems.examples.iphone32 // { + sdkVer = iosSdkVersion; + inherit xcodeVer; }; - # Back compat - arm64 = lib.warn "nixpkgsCross.ios.arm64 has been deprecated, using nixpkgsCross.ios.aarch64 instead." aarch64; }; - ghcjs = nixpkgsFunc (nixpkgsArgs // { - crossSystem = lib.systems.examples.ghcjs; - }); - wasm = nixpkgsFunc (nixpkgsArgs // - (import wasmCross { inherit nixpkgsFunc; }).nixpkgsCrossArgs webGhcSrc "8.6.5" - ); + # Back compat + arm64 = lib.warn " + nixpkgsCross.ios.arm64 + has + been + deprecated, using nixpkgsCross.ios.aarch64 instead." + aarch64; }; + ghcjs = nixpkgsFunc (nixpkgsArgs // { + crossSystem = lib.systems.examples.ghcjs; + }); + wasm = nixpkgsFunc (nixpkgsArgs // + (import wasmCross { inherit nixpkgsFunc; }).nixpkgsCrossArgs webGhcSrc "8.6.5" + ); + }; - haskellLib = nixpkgs.haskell.lib; + haskellLib = nixpkgs.haskell.lib; - overrideCabal = pkg: f: if pkg == null then null else haskellLib.overrideCabal pkg f; + overrideCabal = pkg: f: if pkg == null then null else haskellLib.overrideCabal pkg f; - combineOverrides = old: new: old // new // lib.optionalAttrs (old ? overrides && new ? overrides) { - overrides = lib.composeExtensions old.overrides new.overrides; - }; - # Makes sure that old `overrides` from a previous call to `override` are not - # forgotten, but composed. Do this by overriding `override` and passing a - # function which takes the old argument set and combining it. What a tongue - # twister! - makeRecursivelyOverridable = x: x // { - override = new: makeRecursivelyOverridable (x.override (old: (combineOverrides old new))); - }; + inherit (splices-src) makeRecursivelyOverridable makeRecursivelyOverridableBHPToo combineOverrides; + # Makes sure that old `overrides` from a previous call to `override` are not + # forgotten, but composed. Do this by overriding `override` and passing a + # function which takes the old argument set and combining it. What a tongue + # twister! - cabal2nixResult = src: builtins.trace "cabal2nixResult is deprecated; use ghc.haskellSrc2nix or ghc.callCabal2nix instead" (ghc.haskellSrc2nix { + cabal2nixResult = src: builtins.trace "cabal2nixResult is deprecated; + use ghc.haskellSrc2nix or ghc.callCabal2nix instead" + (ghc.haskellSrc2nix { name = "for-unknown-package"; src = "file://${src}"; sha256 = null; }); - ghcSavedSplices = ghcSavedSplices-8_6; + ghcSavedSplices = ghcSavedSplices-8_10; ghcSavedSplices-8_6 = (makeRecursivelyOverridable nixpkgs.haskell.packages.integer-simple.ghcSplices-8_6).override { - overrides = lib.foldr lib.composeExtensions (_: _: {}) (let - haskellOverlays = nixpkgs.haskell.overlays; - in [ - haskellOverlays.combined - (haskellOverlays.saveSplices "8.6") - (self: super: with haskellLib; { - blaze-textual = haskellLib.enableCabalFlag super.blaze-textual "integer-simple"; - cryptonite = disableCabalFlag super.cryptonite "integer-gmp"; - integer-logarithms = disableCabalFlag super.integer-logarithms "integer-gmp"; - scientific = enableCabalFlag super.scientific "integer-simple"; - dependent-sum-template = dontCheck super.dependent-sum-template; - generic-deriving = dontCheck super.generic-deriving; - }) - ]); + overrides = lib.foldr lib.composeExtensions (_: _: { }) ( + let + haskellOverlays = nixpkgs.haskell.overlays; + in + [ + haskellOverlays.combined + (haskellOverlays.saveSplices "8.6") + (self: super: with haskellLib; { + blaze-textual = haskellLib.enableCabalFlag super.blaze-textual "integer-simple"; + cryptonite = disableCabalFlag super.cryptonite "integer-gmp"; + integer-logarithms = disableCabalFlag super.integer-logarithms "integer-gmp"; + scientific = enableCabalFlag super.scientific "integer-simple"; + dependent-sum-template = dontCheck super.dependent-sum-template; + generic-deriving = dontCheck super.generic-deriving; + }) + ] + ); }; ghcSavedSplices-8_10 = (makeRecursivelyOverridable nixpkgs.haskell.packages.integer-simple.ghcSplices-8_10).override { - overrides = lib.foldr lib.composeExtensions (_: _: {}) (let - haskellOverlays = nixpkgs.haskell.overlays; - in [ - haskellOverlays.combined - (haskellOverlays.saveSplices "8.10") - (self: super: with haskellLib; { - blaze-textual = haskellLib.enableCabalFlag super.blaze-textual "integer-simple"; - cryptonite = disableCabalFlag super.cryptonite "integer-gmp"; - integer-logarithms = disableCabalFlag super.integer-logarithms "integer-gmp"; - scientific = enableCabalFlag super.scientific "integer-simple"; - }) - ]); + overrides = lib.foldr lib.composeExtensions (_: _: { }) ( + let + haskellOverlays = nixpkgs.haskell.overlays; + in + [ + haskellOverlays.combined + (haskellOverlays.saveSplices "8.10") + (self: super: with haskellLib; { + blaze-textual = haskellLib.enableCabalFlag super.blaze-textual "integer-simple"; + cryptonite = disableCabalFlag super.cryptonite "integer-gmp"; + integer-logarithms = disableCabalFlag super.integer-logarithms "integer-gmp"; + scientific = enableCabalFlag super.scientific "integer-simple"; + }) + ] + ); }; ghcjs = ghcjs8_6; ghcjs8_6 = (makeRecursivelyOverridable (nixpkgsCross.ghcjs.haskell.packages.ghcjs86.override (old: { @@ -273,20 +289,6 @@ let iosSupport = system == "x86_64-darwin"; overrides = nixpkgs.haskell.overlays.combined; }; - # Takes a package set with `makeRecursivelyOverridable` and ensures that any - # future overrides will be applied to both the package set itself and it's - # build-time package set (`buildHaskellPackages`). - makeRecursivelyOverridableBHPToo = x: x // { - override = new: makeRecursivelyOverridableBHPToo (x.override - (combineOverrides - { - overrides = self: super: { - buildHaskellPackages = super.buildHaskellPackages.override new; - }; - } - new)); - }; - ghcAndroidAarch64 = ghcAndroidAarch64-8_6; ghcAndroidAarch64-8_6 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.android.aarch64.haskell.packages.integer-simple.ghcSplices-8_6).override { overrides = nixpkgsCross.android.aarch64.haskell.overlays.combined; @@ -354,98 +356,101 @@ let iosSupport = system == "x86_64-darwin"; buildApp = nixpkgs.lib.makeOverridable (import ./ios { inherit nixpkgs ghc; }); }; -in let this = rec { - inherit (nixpkgs) - filterGit - hackGet - thunkSet - ; - inherit nixpkgs - nixpkgsCross - overrideCabal - ghc - ghcHEAD - ghc8_6 - ghc8_10 - ghcIosSimulator64 - ghcIosAarch64 - ghcIosAarch64-8_6 - ghcIosAarch64-8_10 - ghcIosAarch32 - ghcIosAarch32-8_6 - ghcIosAarch32-8_10 - ghcAndroidAarch64 - ghcAndroidAarch64-8_6 - ghcAndroidAarch64-8_10 - ghcAndroidAarch32 - ghcAndroidAarch32-8_6 - ghcAndroidAarch32-8_10 - ghcjs - ghcjs8_6 - ghcjs8_10 - ghcSavedSplices - ghcSavedSplices-8_6 - ghcSavedSplices-8_10 - android - androidWithHaskellPackages - iosAarch32 - iosAarch64 - iosSimulator - iosWithHaskellPackages - wasm - wasmCross - ; - - # Back compat - ios = iosAarch64; - ghcAndroidArm64 = lib.warn "ghcAndroidArm64 has been deprecated, using ghcAndroidAarch64 instead." ghcAndroidAarch64; - ghcAndroidArmv7a = lib.warn "ghcAndroidArmv7a has been deprecated, using ghcAndroidAarch32 instead." ghcAndroidAarch32; - ghcIosArm64 = lib.warn "ghcIosArm64 has been deprecated, using ghcIosAarch64 instead." ghcIosAarch64; - - androidReflexTodomvc = android.buildApp { - package = p: p.reflex-todomvc; - executableName = "reflex-todomvc"; - applicationId = "org.reflexfrp.todomvc"; - displayName = "Reflex TodoMVC"; - }; - androidReflexTodomvc-8_6 = android-8_6.buildApp { - package = p: p.reflex-todomvc; - executableName = "reflex-todomvc"; - applicationId = "org.reflexfrp.todomvc.via_8_6"; - displayName = "Reflex TodoMVC via GHC 8.6"; - }; - androidReflexTodomvc-8_10 = android-8_10.buildApp { - package = p: p.reflex-todomvc; - executableName = "reflex-todomvc"; - applicationId = "org.reflexfrp.todomvc.via_8_10"; - displayName = "Reflex TodoMVC via GHC 8.10"; - }; - iosReflexTodomvc = ios.buildApp { - package = p: p.reflex-todomvc; - executableName = "reflex-todomvc"; - bundleIdentifier = "org.reflexfrp.todomvc"; - bundleName = "Reflex TodoMVC"; - }; - iosReflexTodomvc-8_6 = iosAarch64-8_6.buildApp { - package = p: p.reflex-todomvc; - executableName = "reflex-todomvc"; - bundleIdentifier = "org.reflexfrp.todomvc.via_8_6"; - bundleName = "Reflex TodoMVC via GHC 8.6"; - }; - iosReflexTodomvc-8_10 = iosAarch64-8_10.buildApp { - package = p: p.reflex-todomvc; - executableName = "reflex-todomvc"; - bundleIdentifier = "org.reflexfrp.todomvc.via_8_10"; - bundleName = "Reflex TodoMVC via GHC 8.10"; - }; - iosSimulatorReflexTodomvc = iosSimulator.buildApp { - package = p: p.reflex-todomvc; - executableName = "reflex-todomvc"; - bundleIdentifier = "org.reflexfrp.todomvc"; - bundleName = "Reflex TodoMVC"; - }; - setGhcLibdir = ghcLibdir: inputGhcjs: - let libDir = "$out/lib/ghcjs-${inputGhcjs.version}"; +in +let + this = rec { + inherit (nixpkgs) + filterGit + hackGet + thunkSet + ; + inherit nixpkgs + nixpkgsCross + overrideCabal + ghc + ghcHEAD + ghc8_6 + ghc8_10 + ghcIosSimulator64 + ghcIosAarch64 + ghcIosAarch64-8_6 + ghcIosAarch64-8_10 + ghcIosAarch32 + ghcIosAarch32-8_6 + ghcIosAarch32-8_10 + ghcAndroidAarch64 + ghcAndroidAarch64-8_6 + ghcAndroidAarch64-8_10 + ghcAndroidAarch32 + ghcAndroidAarch32-8_6 + ghcAndroidAarch32-8_10 + ghcjs + ghcjs8_6 + ghcjs8_10 + ghcSavedSplices + ghcSavedSplices-8_6 + ghcSavedSplices-8_10 + android + androidWithHaskellPackages + iosAarch32 + iosAarch64 + iosSimulator + iosWithHaskellPackages + wasm + wasmCross + ; + + # Back compat + ios = iosAarch64; + ghcAndroidArm64 = lib.warn "ghcAndroidArm64 has been deprecated, using ghcAndroidAarch64 instead." ghcAndroidAarch64; + ghcAndroidArmv7a = lib.warn "ghcAndroidArmv7a has been deprecated, using ghcAndroidAarch32 instead." ghcAndroidAarch32; + ghcIosArm64 = lib.warn "ghcIosArm64 has been deprecated, using ghcIosAarch64 instead." ghcIosAarch64; + + androidReflexTodomvc = android.buildApp { + package = p: p.reflex-todomvc; + executableName = "reflex-todomvc"; + applicationId = "org.reflexfrp.todomvc"; + displayName = "Reflex TodoMVC"; + }; + androidReflexTodomvc-8_6 = android-8_6.buildApp { + package = p: p.reflex-todomvc; + executableName = "reflex-todomvc"; + applicationId = "org.reflexfrp.todomvc.via_8_6"; + displayName = "Reflex TodoMVC via GHC 8.6"; + }; + androidReflexTodomvc-8_10 = android-8_10.buildApp { + package = p: p.reflex-todomvc; + executableName = "reflex-todomvc"; + applicationId = "org.reflexfrp.todomvc.via_8_10"; + displayName = "Reflex TodoMVC via GHC 8.10"; + }; + iosReflexTodomvc = ios.buildApp { + package = p: p.reflex-todomvc; + executableName = "reflex-todomvc"; + bundleIdentifier = "org.reflexfrp.todomvc"; + bundleName = "Reflex TodoMVC"; + }; + iosReflexTodomvc-8_6 = iosAarch64-8_6.buildApp { + package = p: p.reflex-todomvc; + executableName = "reflex-todomvc"; + bundleIdentifier = "org.reflexfrp.todomvc.via_8_6"; + bundleName = "Reflex TodoMVC via GHC 8.6"; + }; + iosReflexTodomvc-8_10 = iosAarch64-8_10.buildApp { + package = p: p.reflex-todomvc; + executableName = "reflex-todomvc"; + bundleIdentifier = "org.reflexfrp.todomvc.via_8_10"; + bundleName = "Reflex TodoMVC via GHC 8.10"; + }; + iosSimulatorReflexTodomvc = iosSimulator.buildApp { + package = p: p.reflex-todomvc; + executableName = "reflex-todomvc"; + bundleIdentifier = "org.reflexfrp.todomvc"; + bundleName = "Reflex TodoMVC"; + }; + setGhcLibdir = ghcLibdir: inputGhcjs: + let + libDir = "$out/lib/ghcjs-${inputGhcjs.version}"; ghcLibdirLink = nixpkgs.stdenv.mkDerivation { name = "ghc_libdir"; inherit ghcLibdir; @@ -454,144 +459,154 @@ in let this = rec { echo "$ghcLibdir" > ${libDir}/ghc_libdir_override ''; }; - in inputGhcjs // { - outPath = nixpkgs.buildEnv { - inherit (inputGhcjs) name; - paths = [ inputGhcjs ghcLibdirLink ]; - postBuild = '' - mv ${libDir}/ghc_libdir_override ${libDir}/ghc_libdir - ''; - }; - }; + in + inputGhcjs // { + outPath = nixpkgs.buildEnv { + inherit (inputGhcjs) name; + paths = [ inputGhcjs ghcLibdirLink ]; + postBuild = '' + mv ${libDir}/ghc_libdir_override ${libDir}/ghc_libdir + ''; + }; + }; - platforms = [ - "ghcjs" - "ghc" - ]; - - androidDevTools = [ - ghc.haven - nixpkgs.maven - nixpkgs.androidsdk_9_0 - ]; - - # Tools that are useful for development under both ghc and ghcjs - generalDevTools' = { nativeHaskellPackages ? ghc }: { - inherit (nativeHaskellPackages) - Cabal - cabal-install - ghcid - hasktags - hlint - stylish-haskell # Recent stylish-haskell only builds with AMP in place - reflex-ghci - ; - inherit (nixpkgs) - cabal2nix - curl - nix-prefetch-scripts - nodejs - pkgconfig - closurecompiler - ; - }; - workOn = haskellPackages: package: (overrideCabal package (drv: { - buildTools = (drv.buildTools or []) ++ builtins.attrValues (generalDevTools' {}); - })).env; - - # A minimal wrapper around the build-wasm-app from wasm-cross - # Useful in building simple cabal projects like reflex-todomvc - build-wasm-app-wrapper = - ename: # Name of the executable, usually same as cabal project name - pkgPath : # Path of cabal package - args: # Others options to pass to build-wasm-app - let - pkg = wasm.callPackage pkgPath {}; - webabi = nixpkgs.callPackage (wasmCross + /webabi) {}; - build-wasm-app = nixpkgs.callPackage (wasmCross + /build-wasm-app.nix) ({ inherit webabi; } // args); - in build-wasm-app { - inherit pkg ename; - }; + platforms = [ + "ghcjs" + "ghc" + ]; + + androidDevTools = [ + ghc.haven + nixpkgs.maven + nixpkgs.androidsdk_9_0 + ]; + + # Tools that are useful for development under both ghc and ghcjs + generalDevTools' = { nativeHaskellPackages ? ghc }: { + inherit (nativeHaskellPackages) + Cabal + cabal-install + ghcid + hasktags + hlint + stylish-haskell# Recent stylish-haskell only builds with AMP in place + reflex-ghci + ; + inherit (nixpkgs) + cabal2nix + curl + nix-prefetch-scripts + nodejs + pkgconfig + closurecompiler + ; + }; - # A simple derivation that just creates a file with the names of all - # of its inputs. If built, it will have a runtime dependency on all - # of the given build inputs. - pinBuildInputs = name: buildInputs: (nixpkgs.releaseTools.aggregate { - inherit name; - constituents = buildInputs; - }).overrideAttrs (old: { - buildCommand = old.buildCommand + '' - echo "$propagatedBuildInputs $buildInputs $nativeBuildInputs $propagatedNativeBuildInputs" > "$out/deps" - ''; - inherit buildInputs; - }); + workOn = haskellPackages: package: (overrideCabal package (drv: { + buildTools = (drv.buildTools or [ ]) ++ builtins.attrValues (generalDevTools' { }); + })).env; + + # A minimal wrapper around the build-wasm-app from wasm-cross + # Useful in building simple cabal projects like reflex-todomvc + build-wasm-app-wrapper = + ename: # Name of the executable, usually same as cabal project name + pkgPath: # Path of cabal package + args: # Others options to pass to build-wasm-app + let + pkg = wasm.callPackage pkgPath { }; + webabi = nixpkgs.callPackage (wasmCross + /webabi) { }; + build-wasm-app = nixpkgs.callPackage (wasmCross + /build-wasm-app.nix) ({ inherit webabi; } // args); + in + build-wasm-app { + inherit pkg ename; + }; - reflexEnv = platform: - let haskellPackages = builtins.getAttr platform this; - ghcWithStuff = if platform == "ghc" || platform == "ghcjs" - then haskellPackages.ghcWithHoogle - else haskellPackages.ghcWithPackages; - in ghcWithStuff (p: import ./packages.nix { - haskellPackages = p; - inherit platform; + # A simple derivation that just creates a file with the names of all + # of its inputs. If built, it will have a runtime dependency on all + # of the given build inputs. + pinBuildInputs = name: buildInputs: (nixpkgs.releaseTools.aggregate { + inherit name; + constituents = buildInputs; + }).overrideAttrs (old: { + buildCommand = old.buildCommand + '' + echo "$propagatedBuildInputs $buildInputs $nativeBuildInputs $propagatedNativeBuildInputs" > "$out/deps" + ''; + inherit buildInputs; }); - tryReflexPackages = builtins.attrValues (generalDevTools' {}) - ++ builtins.map reflexEnv platforms; + reflexEnv = platform: + let + haskellPackages = builtins.getAttr platform this; + ghcWithStuff = + if platform == "ghc" || platform == "ghcjs" + then haskellPackages.ghcWithHoogle + else haskellPackages.ghcWithPackages; + in + ghcWithStuff (p: import ./packages.nix { + haskellPackages = p; + inherit platform; + }); + + tryReflexPackages = builtins.attrValues (generalDevTools' { }) + ++ builtins.map reflexEnv platforms; - cachePackages = - let otherPlatforms = lib.optionals androidSupport [ + cachePackages = + let + otherPlatforms = lib.optionals androidSupport [ "ghcAndroidAarch64" "ghcAndroidAarch32" ] ++ lib.optionals iosSupport [ "ghcIosAarch64" "ghcIosSimulator64" ]; - in tryReflexPackages + in + tryReflexPackages ++ builtins.map reflexEnv otherPlatforms ++ lib.optionals androidSupport [ androidDevTools androidReflexTodomvc ] ++ lib.optionals iosSupport [ - iosReflexTodomvc iosSimulatorReflexTodomvc + iosReflexTodomvc + iosSimulatorReflexTodomvc ]; - inherit cabal2nixResult system androidSupport iosSupport; - project = args: import ./project this (args ({ pkgs = nixpkgs; } // this)); - tryReflexShell = pinBuildInputs ("shell-" + system) tryReflexPackages; - ghcjsExternsJs = ./ghcjs.externs.js; -}; - -# Deprecated reexports. These were made for `./scripts/*`, but are reexported -# here for backwards compatability. -legacy = { - # Added 2019-12, will be removed 2020-06. - inherit - (import ./nix-utils/hackage { reflex-platform = this; }) - attrsToList - mapSet - mkSdist - sdists - mkHackageDocs - hackageDocs - mkReleaseCandidate - releaseCandidates - ; - generalDevTools = _: builtins.attrValues (this.generalDevTools' {}); - generalDevToolsAttrs = _: this.generalDevTools' {}; - nativeHaskellPackages = haskellPackages: - if haskellPackages.isGhcjs or false - then haskellPackages.ghc - else haskellPackages; - workOnMulti' = { env, packageNames }: - (import ./nix-utils/work-on-multi {}).workOnMulti { - envFunc = _: env; - inherit packageNames; - }; - workOnMulti = env: packageNames: legacy.workOnMulti' { inherit env packageNames; }; -}; + inherit cabal2nixResult system androidSupport iosSupport; + project = args: import ./project this (args ({ pkgs = nixpkgs; } // this)); + tryReflexShell = pinBuildInputs ("shell-" + system) tryReflexPackages; + ghcjsExternsJs = ./ghcjs.externs.js; + }; + + # Deprecated reexports. These were made for `./scripts/*`, but are reexported + # here for backwards compatability. + legacy = { + # Added 2019-12, will be removed 2020-06. + inherit + (import ./nix-utils/hackage { reflex-platform = this; }) + attrsToList + mapSet + mkSdist + sdists + mkHackageDocs + hackageDocs + mkReleaseCandidate + releaseCandidates + ; + generalDevTools = _: builtins.attrValues (this.generalDevTools' { }); + generalDevToolsAttrs = _: this.generalDevTools' { }; + nativeHaskellPackages = haskellPackages: + if haskellPackages.isGhcjs or false + then haskellPackages.ghc + else haskellPackages; + workOnMulti' = { env, packageNames }: + (import ./nix-utils/work-on-multi { }).workOnMulti { + envFunc = _: env; + inherit packageNames; + }; + workOnMulti = env: packageNames: legacy.workOnMulti' { inherit env packageNames; }; + }; -in this // lib.optionalAttrs +in +this // lib.optionalAttrs (!hideDeprecated) (lib.mapAttrs (attrName: builtins.trace "The attribute \"${attrName}\" is deprecated. See reflex-platform's root default.nix.") legacy) diff --git a/haskell-overlays/default.nix b/haskell-overlays/default.nix index 754c22c6b..72d1c8439 100644 --- a/haskell-overlays/default.nix +++ b/haskell-overlays/default.nix @@ -1,8 +1,13 @@ { lib , haskellLib , nixpkgs -, useFastWeak, useReflexOptimizer, enableLibraryProfiling, enableTraceReflexEvents -, useTextJSString, enableExposeAllUnfoldings, __useTemplateHaskell +, useFastWeak +, useReflexOptimizer +, enableLibraryProfiling +, enableTraceReflexEvents +, useTextJSString +, enableExposeAllUnfoldings +, __useTemplateHaskell , ghcSavedSplices-8_6 , ghcSavedSplices-8_10 , haskellOverlaysPre @@ -15,18 +20,23 @@ let in rec { - optionalExtension = cond: overlay: if cond then overlay else _: _: {}; + optionalExtension = cond: overlay: if cond then overlay else _: _: { }; - versionWildcard = versionList: let - versionListInc = lib.init versionList ++ [ (lib.last versionList + 1) ]; - bottom = lib.concatStringsSep "." (map toString versionList); - top = lib.concatStringsSep "." (map toString versionListInc); - in version: lib.versionOlder version top && lib.versionAtLeast version bottom; + versionWildcard = versionList: + let + versionListInc = lib.init versionList ++ [ (lib.last versionList + 1) ]; + bottom = lib.concatStringsSep "." (map toString versionList); + top = lib.concatStringsSep "." (map toString versionListInc); + in + version: lib.versionOlder version top && lib.versionAtLeast version bottom; - foldExtensions = lib.foldr lib.composeExtensions (_: _: {}); + foldExtensions = lib.foldr lib.composeExtensions (_: _: { }); getGhcVersion = ghc: ghc.version; + splices-load-save-nix = ../../splices-load-save.nix; + splices-func = import splices-load-save-nix { pkgs = nixpkgs; }; + ## ## Conventional roll ups of all the constituent overlays below. ## @@ -47,38 +57,48 @@ rec { (optionalExtension (!(super.ghc.isGhcjs or false)) combined-ghc) (optionalExtension (super.ghc.isGhcjs or false) combined-ghcjs) - (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 6 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) loadSplices-8_6) - (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 10 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) loadSplices-8_10) + (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 6 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) loadSplices8_6) + (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 10 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) splices-func.loadSplices8_10) (optionalExtension (nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt or false) android) (optionalExtension (nixpkgs.stdenv.hostPlatform.isiOS or false) ios) (optionalExtension (nixpkgs.stdenv.hostPlatform.isWasm or false) wasm) user-custom-post - ] self super; + ] + self + super; combined-any = self: super: foldExtensions [ any (optionalExtension (versionWildcard [ 8 ] (getGhcVersion super.ghc)) combined-any-8) - ] self super; + ] + self + super; combined-any-8 = self: super: foldExtensions [ any-8 (optionalExtension (versionWildcard [ 8 6 ] (getGhcVersion super.ghc)) any-8_6) (optionalExtension (versionWildcard [ 8 6 ] (getGhcVersion super.ghc)) haskell-gi-8_6) (optionalExtension (versionWildcard [ 8 10 ] (getGhcVersion super.ghc)) haskell-gi-8_10) - (optionalExtension (lib.versionOlder "8.11" (getGhcVersion super.ghc)) any-head) - ] self super; + (optionalExtension (lib.versionOlder "8.11" (getGhcVersion super.ghc)) any-head) + ] + self + super; combined-ghc = self: super: foldExtensions [ (optionalExtension (versionWildcard [ 8 6 ] super.ghc.version) ghc-8_6) - (optionalExtension (lib.versionOlder "8.11" super.ghc.version) ghc-head) - ] self super; + (optionalExtension (lib.versionOlder "8.11" super.ghc.version) ghc-head) + ] + self + super; combined-ghcjs = self: super: foldExtensions [ (optionalExtension (versionWildcard [ 8 6 ] (getGhcVersion super.ghc)) combined-ghcjs-8_6) (optionalExtension (versionWildcard [ 8 10 ] (getGhcVersion super.ghc)) combined-ghcjs-8_10) - ] self super; + ] + self + super; combined-ghcjs-8_6 = self: super: foldExtensions [ ghcjs_8_6 @@ -86,14 +106,18 @@ rec { (optionalExtension useTextJSString textJSString-8_6) (optionalExtension useTextJSString ghcjs-textJSString-8_6) (optionalExtension useFastWeak ghcjs-fast-weak_8_6) - ] self super; + ] + self + super; combined-ghcjs-8_10 = self: super: foldExtensions [ (optionalExtension useTextJSString textJSString) (optionalExtension useTextJSString textJSString-8_10) (optionalExtension useTextJSString ghcjs-textJSString-8_10) (optionalExtension useFastWeak ghcjs-fast-weak_8_10) - ] self super; + ] + self + super; ## ## Constituent @@ -108,31 +132,31 @@ rec { exposeAllUnfoldings = import ./expose-all-unfoldings.nix { }; # For GHC and GHCJS - any = _: _: {}; + any = _: _: { }; any-8 = import ./any-8.nix { inherit haskellLib lib getGhcVersion; }; any-8_6 = import ./any-8.6.nix { inherit haskellLib fetchFromGitHub; inherit (nixpkgs) pkgs; }; any-head = import ./any-head.nix { inherit haskellLib fetchFromGitHub; }; # Just for GHC, usually to sync with GHCJS - ghc-8_6 = _: _: {}; - ghc-head = _: _: {}; + ghc-8_6 = _: _: { }; + ghc-head = _: _: { }; profiling = import ./profiling.nix { inherit haskellLib; inherit enableLibraryProfiling; }; - saveSplices = ghcVersion: import ./splices-load-save/save-splices.nix { + saveSplices = ghcVersion: import "${splices-load-save-nix}/save-splices.nix" { inherit lib haskellLib fetchFromGitHub ghcVersion; }; - loadSplices-8_6 = import ./splices-load-save/load-splices.nix { + loadSplices-8_6 = import "${splices-load-save-nix}/load-splices.nix" { inherit lib haskellLib fetchFromGitHub; isExternalPlugin = false; splicedHaskellPackages = ghcSavedSplices-8_6; }; - loadSplices-8_10 = import ./splices-load-save/load-splices.nix { + loadSplices-8_10 = import "${splices-load-save-nix}/load-splices.nix" { inherit lib haskellLib fetchFromGitHub; isExternalPlugin = true; splicedHaskellPackages = ghcSavedSplices-8_10; diff --git a/haskell-overlays/splices-load-save/dep/ghc-8.10/default.nix b/haskell-overlays/splices-load-save/dep/ghc-8.10/default.nix deleted file mode 100644 index 2b4d4ab11..000000000 --- a/haskell-overlays/splices-load-save/dep/ghc-8.10/default.nix +++ /dev/null @@ -1,2 +0,0 @@ -# DO NOT HAND-EDIT THIS FILE -import (import ./thunk.nix) \ No newline at end of file diff --git a/haskell-overlays/splices-load-save/dep/ghc-8.10/github.json b/haskell-overlays/splices-load-save/dep/ghc-8.10/github.json deleted file mode 100644 index 2ae87412e..000000000 --- a/haskell-overlays/splices-load-save/dep/ghc-8.10/github.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "owner": "obsidiansystems", - "repo": "ghc", - "rev": "93063be3b9e3bcd973f2bd78fadb17f19888320e", - "sha256": "1xpdv3sxlppnfwzwkc18fp13srpbnca0qi8a6206ccpq3h48zv6n", - "fetchSubmodules": true -} diff --git a/haskell-overlays/splices-load-save/dep/ghc-8.10/thunk.nix b/haskell-overlays/splices-load-save/dep/ghc-8.10/thunk.nix deleted file mode 100644 index bbf2dc18f..000000000 --- a/haskell-overlays/splices-load-save/dep/ghc-8.10/thunk.nix +++ /dev/null @@ -1,9 +0,0 @@ -# DO NOT HAND-EDIT THIS FILE -let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }: - if !fetchSubmodules && !private then builtins.fetchTarball { - url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256; - } else (import {}).fetchFromGitHub { - inherit owner repo rev sha256 fetchSubmodules private; - }; - json = builtins.fromJSON (builtins.readFile ./github.json); -in fetch json \ No newline at end of file diff --git a/haskell-overlays/splices-load-save/dep/ghc-8.6/default.nix b/haskell-overlays/splices-load-save/dep/ghc-8.6/default.nix deleted file mode 100644 index 2b4d4ab11..000000000 --- a/haskell-overlays/splices-load-save/dep/ghc-8.6/default.nix +++ /dev/null @@ -1,2 +0,0 @@ -# DO NOT HAND-EDIT THIS FILE -import (import ./thunk.nix) \ No newline at end of file diff --git a/haskell-overlays/splices-load-save/dep/ghc-8.6/git.json b/haskell-overlays/splices-load-save/dep/ghc-8.6/git.json deleted file mode 100644 index 31518e75d..000000000 --- a/haskell-overlays/splices-load-save/dep/ghc-8.6/git.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "url": "https://gitlab.haskell.org/obsidiansystems/ghc", - "rev": "856e342d906e39e8bf2ece1f73445f616b74946e", - "sha256": "1r3glwyp84agzssgr3kh0ylh098yrzjprbvfhgxwy2vsn2d2c0b3", - "private": false, - "fetchSubmodules": true, - "branch": "wip/abrar/splices-8.6.5" -} diff --git a/haskell-overlays/splices-load-save/dep/ghc-8.6/thunk.nix b/haskell-overlays/splices-load-save/dep/ghc-8.6/thunk.nix deleted file mode 100644 index e3b8c830d..000000000 --- a/haskell-overlays/splices-load-save/dep/ghc-8.6/thunk.nix +++ /dev/null @@ -1,14 +0,0 @@ -# DO NOT HAND-EDIT THIS FILE -let fetch = {url, rev, branch ? null, sha256 ? null, fetchSubmodules ? false, private ? false, ...}: - let realUrl = let firstChar = builtins.substring 0 1 url; in - if firstChar == "/" then /. + url - else if firstChar == "." then ./. + url - else url; - in if !fetchSubmodules && private then builtins.fetchGit { - url = realUrl; inherit rev; - ${if branch == null then null else "ref"} = branch; - } else (import {}).fetchgit { - url = realUrl; inherit rev sha256; - }; - json = builtins.fromJSON (builtins.readFile ./git.json); -in fetch json \ No newline at end of file diff --git a/haskell-overlays/splices-load-save/load-splices.nix b/haskell-overlays/splices-load-save/load-splices.nix deleted file mode 100644 index bd8a6879d..000000000 --- a/haskell-overlays/splices-load-save/load-splices.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ haskellLib, fetchFromGitHub, lib, splicedHaskellPackages, isExternalPlugin }: - -self: super: - -let splicedPkg = drv: - if builtins.hasAttr drv.pname self.buildHaskellPackages - then builtins.getAttr drv.pname self.buildHaskellPackages - else if builtins.hasAttr (attrName drv) self.buildHaskellPackages - then builtins.getAttr (attrName drv) self.buildHaskellPackages - else throw "no spliced pkg for: ${drv.name}"; - - hasSplicedPkg = drv: - (builtins.hasAttr drv.pname self.buildHaskellPackages || - builtins.hasAttr (attrName drv) self.buildHaskellPackages) && - !(builtins.elem drv.pname nonHsPkgs); - - # splicedPkg returns null for those - nonHsPkgs = [ "android-activity" ]; - - attrName = drv: - "${drv.pname}_${lib.replaceStrings ["."] ["_"] drv.version}"; - - spliceDir = drv: let splicedDrv = splicedPkg drv; in - if splicedDrv == null - then throw "splicedDrv == null for drv = ${drv.pname}" - else if splicedDrv.compiler == null - then throw "spliceDrv.compiler == null" - else "${splicedDrv}/lib/${splicedDrv.compiler.name}/${splicedDrv.name}"; - - # Base steps for every preBuild phase - preBuildBaseAttrs = drv: - { - preBuild = '' - ${drv.preBuild or ""} - echo "!!! has splices: ${if hasSplicedPkg drv then "yes" else "no"}" - echo "!!! splices at: ${if hasSplicedPkg drv then spliceDir drv else "N/A"} !!!" - ''; - }; - # Additional preBuilds steps if the compiler supports external plugins - # E.g. GHC version > 8.6 - preBuildExternalPluginAttrs = drv: lib.optionalAttrs (hasSplicedPkg drv && isExternalPlugin) - { - preBuild = '' - export EXTERNAL_SPLICES_LOAD=${spliceDir drv} - ''; - }; -in { - buildHaskellPackages = splicedHaskellPackages; - - # Add some flags to load splices from nativeHaskellPackages - mkDerivation = drv: super.mkDerivation (drv // - { - buildFlags = lib.optional (hasSplicedPkg drv && !isExternalPlugin) "--ghc-option=-load-splices=${spliceDir drv}" - ++ (drv.buildFlags or []); - preBuild = (preBuildBaseAttrs drv).preBuild + ((preBuildExternalPluginAttrs drv).preBuild or ""); - }); -} diff --git a/haskell-overlays/splices-load-save/save-splices.nix b/haskell-overlays/splices-load-save/save-splices.nix deleted file mode 100644 index 573eb86d3..000000000 --- a/haskell-overlays/splices-load-save/save-splices.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ haskellLib, fetchFromGitHub, lib, ghcVersion }: -let - isExternalPlugin = lib.versionOlder "8.6" ghcVersion; - # Add pre configure attributes if our compiler has no support for external plugins - # e.g. when GHC version <= 8.6 - preConfigureAttrs = attrs: lib.optionalAttrs (!isExternalPlugin) - { - preConfigure = '' - ${attrs.preConfigure or ""} - configureFlags+=" --ghc-option=-save-splices=$out$SPLICE_DIR" - ''; - }; - - # Add pre build attributes if our compiler has support for external plugins - # e.g. when GHC version > 8.6 - preBuildAttrs = attrs: lib.optionalAttrs isExternalPlugin - { - preBuild = '' - ${attrs.preBuild or ""} - echo "!!! save-splices: $out$SPLICE_DIR" - export EXTERNAL_SPLICES_SAVE=$out$SPLICE_DIR - ''; - }; -in self: super: { - mkDerivation = attrs: let - drv = super.mkDerivation (attrs // preConfigureAttrs attrs // preBuildAttrs attrs); - - SPLICE_DIR = "/lib/${drv.compiler.name}/${drv.name}"; - - in ((drv.overrideAttrs (_: { inherit SPLICE_DIR; })) // { inherit SPLICE_DIR; }); - - vector-th-unbox = haskellLib.dontCheck super.vector-th-unbox; - lens = haskellLib.dontCheck super.lens; - - # Can’t build it outside of android. Hopefully no one wants to use - # template haskell with it. - android-activity = null; -} From 4306ce00f481837803fc604ea5370449ca7dc6f9 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Fri, 24 Jun 2022 11:11:58 -0500 Subject: [PATCH 02/11] Make it usable --- default.nix | 7 ++++++- haskell-overlays/default.nix | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index 3fff27233..0443beae6 100644 --- a/default.nix +++ b/default.nix @@ -24,7 +24,12 @@ let "13.2" = "11.3.1"; }.${iosSdkVersion} or (throw "Unknown iosSdkVersion: ${iosSdkVersion}"); - splices-load-save-nix = ../splices-load-save.nix/default.nix; + splices-load-save-nix = nixpkgs.fetchFromGitHub { + owner = "obsidiansystems"; + repo = "splices-load-save.nix"; + rev = "f23074aac612e1047d5b58bf8fe9528ee86a5a26"; + sha256 = lib.fakeHash; + }; splices-src = import splices-load-save-nix { pkgs = nixpkgs; }; # Overlay for GHC which supports the external splices plugin diff --git a/haskell-overlays/default.nix b/haskell-overlays/default.nix index 72d1c8439..7ea7ec572 100644 --- a/haskell-overlays/default.nix +++ b/haskell-overlays/default.nix @@ -34,7 +34,12 @@ rec { getGhcVersion = ghc: ghc.version; - splices-load-save-nix = ../../splices-load-save.nix; + splices-load-save-nix = nixpkgs.fetchFromGitHub { + owner = "obsidiansystems"; + repo = "splices-load-save.nix"; + rev = "f23074aac612e1047d5b58bf8fe9528ee86a5a26"; + sha256 = lib.fakeHash; + }; splices-func = import splices-load-save-nix { pkgs = nixpkgs; }; ## @@ -58,7 +63,7 @@ rec { (optionalExtension (super.ghc.isGhcjs or false) combined-ghcjs) (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 6 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) loadSplices8_6) - (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 10 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) splices-func.loadSplices8_10) + (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 10 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) splices-func.loadSplices8_10 ghcSplices-8_10) (optionalExtension (nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt or false) android) (optionalExtension (nixpkgs.stdenv.hostPlatform.isiOS or false) ios) From 08435e9e93a42797e718ef4fa2d2fecad99031cc Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Fri, 24 Jun 2022 13:24:11 -0500 Subject: [PATCH 03/11] Make everything work --- default.nix | 69 ++++++++++++++++++------------------ haskell-overlays/default.nix | 21 ++++++----- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/default.nix b/default.nix index 0443beae6..3d0525843 100644 --- a/default.nix +++ b/default.nix @@ -27,8 +27,8 @@ let splices-load-save-nix = nixpkgs.fetchFromGitHub { owner = "obsidiansystems"; repo = "splices-load-save.nix"; - rev = "f23074aac612e1047d5b58bf8fe9528ee86a5a26"; - sha256 = lib.fakeHash; + rev = "95e2980210920d52618465970313882cb8356a0e"; + sha256 = "sha256-WkViWz5e0tbVc6mgp+fQyC069nXQe6uvmDFN4/Os81g="; }; splices-src = import splices-load-save-nix { pkgs = nixpkgs; }; @@ -54,25 +54,25 @@ let # from the src proper. patches = [ ]; }); - ghcSplices-8_10 = (splices-src.patchGHC (super.haskell.compiler.ghc8107)).override { }; /*(splices-src.ghc810patched.override - { - # New option for GHC 8.10. Explicitly enable profiling builds - enableProfiledLibs = true; - }).overrideAttrs - (drv: { - # When building from the ghc git repo, ./boot must be run before configuring, whereas - # in the distribution tarball on the haskell.org downloads page, ./boot has already been - # run. - preConfigure = '' + ghcSplices-8_10 = splices-src.patchGHC (super.haskell.compiler.ghc8107); /*(splices-src.ghc810patched.override + /*{ + # New option for GHC 8.10. Explicitly enable profiling builds + enableProfiledLibs = true; + }).overrideAttrs + (drv: { + # When building from the ghc git repo, ./boot must be run before configuring, whereas + # in the distribution tarball on the haskell.org downloads page, ./boot has already been + # run. + preConfigure = '' echo ${drv.version} >VERSION ./boot '' + drv.preConfigure or " "; - patches = [ - #Patch libraries/unix/config.sub to fix android build - ./nixpkgs-overlays/android-8.10-splices.patch - ]; - }); - */ + patches = [ + #Patch libraries/unix/config.sub to fix android build + ./nixpkgs-overlays/android-8.10-splices.patch + ]; + }); + */ }; packages = super.haskell.packages // { ghcSplices-8_6 = super.haskell.packages.ghc865.override { @@ -240,21 +240,22 @@ let ); }; ghcSavedSplices-8_10 = (makeRecursivelyOverridable nixpkgs.haskell.packages.integer-simple.ghcSplices-8_10).override { - overrides = lib.foldr lib.composeExtensions (_: _: { }) ( - let - haskellOverlays = nixpkgs.haskell.overlays; - in - [ - haskellOverlays.combined - (haskellOverlays.saveSplices "8.10") - (self: super: with haskellLib; { - blaze-textual = haskellLib.enableCabalFlag super.blaze-textual "integer-simple"; - cryptonite = disableCabalFlag super.cryptonite "integer-gmp"; - integer-logarithms = disableCabalFlag super.integer-logarithms "integer-gmp"; - scientific = enableCabalFlag super.scientific "integer-simple"; - }) - ] - ); + overrides = lib.foldr lib.composeExtensions (_: _: { }) + ( + let + haskellOverlays = nixpkgs.haskell.overlays; + in + [ + haskellOverlays.combined + (haskellOverlays.saveSplices "8.10") + (self: super: with haskellLib; { + blaze-textual = haskellLib.enableCabalFlag super.blaze-textual "integer-simple"; + cryptonite = disableCabalFlag super.cryptonite "integer-gmp"; + integer-logarithms = disableCabalFlag super.integer-logarithms "integer-gmp"; + scientific = enableCabalFlag super.scientific "integer-simple"; + }) + ] + ); }; ghcjs = ghcjs8_6; ghcjs8_6 = (makeRecursivelyOverridable (nixpkgsCross.ghcjs.haskell.packages.ghcjs86.override (old: { @@ -283,7 +284,7 @@ let overrides = nixpkgsCross.wasm.haskell.overlays.combined; }); - ghc = ghc8_6; + ghc = ghcSavedSplices-8_10; ghcHEAD = (makeRecursivelyOverridable nixpkgs.haskell.packages.ghcHEAD).override { overrides = nixpkgs.haskell.overlays.combined; }; diff --git a/haskell-overlays/default.nix b/haskell-overlays/default.nix index 7ea7ec572..1fb3b9078 100644 --- a/haskell-overlays/default.nix +++ b/haskell-overlays/default.nix @@ -37,14 +37,13 @@ rec { splices-load-save-nix = nixpkgs.fetchFromGitHub { owner = "obsidiansystems"; repo = "splices-load-save.nix"; - rev = "f23074aac612e1047d5b58bf8fe9528ee86a5a26"; - sha256 = lib.fakeHash; + rev = "95e2980210920d52618465970313882cb8356a0e"; + sha256 = "sha256-WkViWz5e0tbVc6mgp+fQyC069nXQe6uvmDFN4/Os81g="; + }; + splices-func = import "${splices-load-save-nix}" { + pkgs = nixpkgs; }; - splices-func = import splices-load-save-nix { pkgs = nixpkgs; }; - ## - ## Conventional roll ups of all the constituent overlays below. - ## # `super.ghc` is used so that the use of an overlay does not depend on that # overlay. At the cost of violating the usual rules on using `self` vs @@ -62,8 +61,8 @@ rec { (optionalExtension (!(super.ghc.isGhcjs or false)) combined-ghc) (optionalExtension (super.ghc.isGhcjs or false) combined-ghcjs) - (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 6 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) loadSplices8_6) - (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 10 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) splices-func.loadSplices8_10 ghcSplices-8_10) + (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 6 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) lsplices8_6) + (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 10 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) lsplices8_10) (optionalExtension (nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt or false) android) (optionalExtension (nixpkgs.stdenv.hostPlatform.isiOS or false) ios) @@ -151,9 +150,9 @@ rec { inherit enableLibraryProfiling; }; - saveSplices = ghcVersion: import "${splices-load-save-nix}/save-splices.nix" { - inherit lib haskellLib fetchFromGitHub ghcVersion; - }; + saveSplices = name: splices-func.saveSplices name; + lsplices8_10 = splices-func.loadSplices-8_10 ghcSavedSplices-8_10; + lsplices8_6 = splices-func.loadSplices-8_6 ghcSavedSplices-8_6; loadSplices-8_6 = import "${splices-load-save-nix}/load-splices.nix" { inherit lib haskellLib fetchFromGitHub; From 767cb002c2051a9b0e1be953b37ea2eb3339f96a Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Wed, 29 Jun 2022 11:12:51 -0500 Subject: [PATCH 04/11] add ghcjs splices --- default.nix | 45 +++++++++++++++++++----------------- haskell-overlays/default.nix | 35 +++++++++++++--------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/default.nix b/default.nix index 3d0525843..1ad362a59 100644 --- a/default.nix +++ b/default.nix @@ -27,9 +27,10 @@ let splices-load-save-nix = nixpkgs.fetchFromGitHub { owner = "obsidiansystems"; repo = "splices-load-save.nix"; - rev = "95e2980210920d52618465970313882cb8356a0e"; - sha256 = "sha256-WkViWz5e0tbVc6mgp+fQyC069nXQe6uvmDFN4/Os81g="; + rev = "8b437239873c4f054cf5d03e61047a294bba5e4a"; + sha256 = "sha256-cWbF23Dqnpc9+UUnK7TxcPzVEE4rj2Ld+1gwiw027ls="; }; + #splices-load-save-nix = ../splices-load-save.nix/default.nix; splices-src = import splices-load-save-nix { pkgs = nixpkgs; }; # Overlay for GHC which supports the external splices plugin @@ -54,25 +55,8 @@ let # from the src proper. patches = [ ]; }); - ghcSplices-8_10 = splices-src.patchGHC (super.haskell.compiler.ghc8107); /*(splices-src.ghc810patched.override - /*{ - # New option for GHC 8.10. Explicitly enable profiling builds - enableProfiledLibs = true; - }).overrideAttrs - (drv: { - # When building from the ghc git repo, ./boot must be run before configuring, whereas - # in the distribution tarball on the haskell.org downloads page, ./boot has already been - # run. - preConfigure = '' - echo ${drv.version} >VERSION - ./boot - '' + drv.preConfigure or " "; - patches = [ - #Patch libraries/unix/config.sub to fix android build - ./nixpkgs-overlays/android-8.10-splices.patch - ]; - }); - */ + ghcSplices-8_10 = splices-src.patchGHC (super.haskell.compiler.ghc8107); + ghcjsSplices-8_10 = splices-src.patchGHCJS (super.haskell.compiler.ghcjs810); }; packages = super.haskell.packages // { ghcSplices-8_6 = super.haskell.packages.ghc865.override { @@ -83,6 +67,10 @@ let buildHaskellPackages = self.buildPackages.haskell.packages.ghcSplices-8_10; ghc = self.buildPackages.haskell.compiler.ghcSplices-8_10; }; + ghcjsSplices-8_10 = super.haskell.packages.ghcjs810.override { + buildHaskellPackages = self.buildPackages.haskell.packages.ghcjsSplices-8_10; + ghc = self.buildPackages.haskell.compiler.ghcjsSplices-8_10; + }; }; }; }; @@ -94,6 +82,7 @@ let haskell = super.haskell // { overlays = super.haskell.overlays or { } // import ./haskell-overlays { nixpkgs = self; + splices-func = splices-src; inherit (self) lib; haskellLib = self.haskell.lib; inherit @@ -276,6 +265,13 @@ let overrides = nixpkgsCross.ghcjs.haskell.overlays.combined; }; + ghcjsSplices-8_10 = (makeRecursivelyOverridable nixpkgs.haskell.packages.ghcjsSplices-8_10).override { + overrides = lib.foldr lib.composeExtensions (_: _: { }) ([ + nixpkgs.haskell.overlays.combined + nixpkgs.haskell.overlays.ghcjs-splices + ]); + }; + wasm = ghcWasm32-8_6; ghcWasm32-8_6 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable (nixpkgsCross.wasm.haskell.packages.ghcWasm.override (old: { # Due to the splices changes the parallel build fails while building the libraries @@ -393,6 +389,7 @@ let ghcjs ghcjs8_6 ghcjs8_10 + ghcjsSplices-8_10 ghcSavedSplices ghcSavedSplices-8_6 ghcSavedSplices-8_10 @@ -541,6 +538,12 @@ let inherit buildInputs; }); + forceGHC = rp: + let + rp810 = rp // { ghc = rp.ghc8_10; ghcjs = rp.ghcjs8_10; }; + in + rp810 // { project = args: import ((hackGet ./dep/reflex-platform) + "/project") rp810 (args ({ pkgs = rp.nixpkgs; } // rp810)); }; + reflexEnv = platform: let haskellPackages = builtins.getAttr platform this; diff --git a/haskell-overlays/default.nix b/haskell-overlays/default.nix index 1fb3b9078..28452652d 100644 --- a/haskell-overlays/default.nix +++ b/haskell-overlays/default.nix @@ -12,6 +12,7 @@ , ghcSavedSplices-8_10 , haskellOverlaysPre , haskellOverlaysPost +, splices-func }: let @@ -34,17 +35,6 @@ rec { getGhcVersion = ghc: ghc.version; - splices-load-save-nix = nixpkgs.fetchFromGitHub { - owner = "obsidiansystems"; - repo = "splices-load-save.nix"; - rev = "95e2980210920d52618465970313882cb8356a0e"; - sha256 = "sha256-WkViWz5e0tbVc6mgp+fQyC069nXQe6uvmDFN4/Os81g="; - }; - splices-func = import "${splices-load-save-nix}" { - pkgs = nixpkgs; - }; - - # `super.ghc` is used so that the use of an overlay does not depend on that # overlay. At the cost of violating the usual rules on using `self` vs # `super`, this avoids a bunch of strictness issues keeping us terminating. @@ -61,8 +51,8 @@ rec { (optionalExtension (!(super.ghc.isGhcjs or false)) combined-ghc) (optionalExtension (super.ghc.isGhcjs or false) combined-ghcjs) - (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 6 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) lsplices8_6) - (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 10 ] super.ghc.version && !(super.ghc.isGhcjs or false) && hostPlatform != buildPlatform) lsplices8_10) + (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 6 ] super.ghc.version && hostPlatform != buildPlatform) (lsplices8_6 ghcSavedSplices-8_6)) + (optionalExtension (with nixpkgs.stdenv; versionWildcard [ 8 10 ] super.ghc.version && hostPlatform != buildPlatform) (lsplices8_10 ghcSavedSplices-8_10)) (optionalExtension (nixpkgs.stdenv.hostPlatform.useAndroidPrebuilt or false) android) (optionalExtension (nixpkgs.stdenv.hostPlatform.isiOS or false) ios) @@ -123,6 +113,12 @@ rec { self super; + ghcjs-splices = self: super: foldExtensions [ + (lsplices8_10 ghcSavedSplices-8_10) + ] + self + super; + ## ## Constituent ## @@ -151,20 +147,21 @@ rec { }; saveSplices = name: splices-func.saveSplices name; - lsplices8_10 = splices-func.loadSplices-8_10 ghcSavedSplices-8_10; - lsplices8_6 = splices-func.loadSplices-8_6 ghcSavedSplices-8_6; + lsplices8_10 = splicepkgs: splices-func.loadSplices8_10 splicepkgs; + lsplices8_6 = splicepkgs: splices-func.loadSplices-8_6 splicepkgs; - loadSplices-8_6 = import "${splices-load-save-nix}/load-splices.nix" { + /*loadSplices-8_6 = import "${splices-load-save-nix}/load-splices.nix" { inherit lib haskellLib fetchFromGitHub; isExternalPlugin = false; splicedHaskellPackages = ghcSavedSplices-8_6; - }; + }; - loadSplices-8_10 = import "${splices-load-save-nix}/load-splices.nix" { + loadSplices-8_10 = import "${splices-load-save-nix}/load-splices.nix" { inherit lib haskellLib fetchFromGitHub; isExternalPlugin = true; splicedHaskellPackages = ghcSavedSplices-8_10; - }; + }; + */ # Just for GHCJS ghcjs_8_6 = import ./ghcjs-8.6 { From 28315560037556ee8a71eb03b6416984dd95a1d9 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Wed, 29 Jun 2022 11:15:42 -0500 Subject: [PATCH 05/11] cleanup --- default.nix | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/default.nix b/default.nix index 1ad362a59..ecfa46633 100644 --- a/default.nix +++ b/default.nix @@ -280,7 +280,7 @@ let overrides = nixpkgsCross.wasm.haskell.overlays.combined; }); - ghc = ghcSavedSplices-8_10; + ghc = ghc8_6; ghcHEAD = (makeRecursivelyOverridable nixpkgs.haskell.packages.ghcHEAD).override { overrides = nixpkgs.haskell.overlays.combined; }; @@ -538,12 +538,6 @@ let inherit buildInputs; }); - forceGHC = rp: - let - rp810 = rp // { ghc = rp.ghc8_10; ghcjs = rp.ghcjs8_10; }; - in - rp810 // { project = args: import ((hackGet ./dep/reflex-platform) + "/project") rp810 (args ({ pkgs = rp.nixpkgs; } // rp810)); }; - reflexEnv = platform: let haskellPackages = builtins.getAttr platform this; From e65c8e7ea7f462d8bfe8a38efe483bf9816f3482 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Wed, 29 Jun 2022 11:41:16 -0500 Subject: [PATCH 06/11] Fix various issues --- default.nix | 25 +---- haskell-overlays/default.nix | 2 +- release.nix | 201 ++++++++++++++++++----------------- 3 files changed, 108 insertions(+), 120 deletions(-) diff --git a/default.nix b/default.nix index ecfa46633..5bab57d2e 100644 --- a/default.nix +++ b/default.nix @@ -27,8 +27,8 @@ let splices-load-save-nix = nixpkgs.fetchFromGitHub { owner = "obsidiansystems"; repo = "splices-load-save.nix"; - rev = "8b437239873c4f054cf5d03e61047a294bba5e4a"; - sha256 = "sha256-cWbF23Dqnpc9+UUnK7TxcPzVEE4rj2Ld+1gwiw027ls="; + rev = "7d51421ebb054ba86d890d7cac91bc8f91240148"; + sha256 = "sha256-gw1EwL5MqbVK0enGoD3hcRtRn7+6JAjmk4iF5HShH34="; }; #splices-load-save-nix = ../splices-load-save.nix/default.nix; @@ -37,25 +37,8 @@ let splicesEval = self: super: { haskell = super.haskell // { compiler = super.haskell.compiler // { - ghcSplices-8_6 = super.haskell.compiler.ghc865.overrideAttrs (drv: { - enableParallelBuilding = false; - src = nixpkgs.hackGet "${splices-load-save-nix}"; - # When building from the ghc git repo, ./boot must be run before configuring, whereas - # in the distribution tarball on the haskell.org downloads page, ./boot has already been - # run. - preConfigure = '' - echo ${drv.version} >VERSION - ./boot - '' + drv.preConfigure or ""; - # Our fork of 8.6 with splices includes these patches. - # Specifically, is up to date with the `ghc-8.6` branch upstream, - # which contains various backports for any potential newer 8.6.x - # release. Nixpkgs manually applied some of those backports as - # patches onto 8.6.5 ahead of such a release, but now we get them - # from the src proper. - patches = [ ]; - }); - ghcSplices-8_10 = splices-src.patchGHC (super.haskell.compiler.ghc8107); + ghcSplices-8_6 = (splices-src.patchGHC (super.haskell.compiler.ghc865) "ghc-8.6.5"); + ghcSplices-8_10 = (splices-src.patchGHC (super.haskell.compiler.ghc8107) "ghc-8.10.7"); ghcjsSplices-8_10 = splices-src.patchGHCJS (super.haskell.compiler.ghcjs810); }; packages = super.haskell.packages // { diff --git a/haskell-overlays/default.nix b/haskell-overlays/default.nix index 28452652d..7002017bd 100644 --- a/haskell-overlays/default.nix +++ b/haskell-overlays/default.nix @@ -148,7 +148,7 @@ rec { saveSplices = name: splices-func.saveSplices name; lsplices8_10 = splicepkgs: splices-func.loadSplices8_10 splicepkgs; - lsplices8_6 = splicepkgs: splices-func.loadSplices-8_6 splicepkgs; + lsplices8_6 = splicepkgs: splices-func.loadSplices8_6 splicepkgs; /*loadSplices-8_6 = import "${splices-load-save-nix}/load-splices.nix" { inherit lib haskellLib fetchFromGitHub; diff --git a/release.nix b/release.nix index 0ed7f3be5..e8c7f1d57 100644 --- a/release.nix +++ b/release.nix @@ -19,122 +19,127 @@ let (crossPkgs: lib.optionals (crossPkgs != null) [ crossPkgs.buildPackages.haskellPackages.cabal2nix ]) [ - reflex-platform.nixpkgsCross.ios.aarch64 - reflex-platform.nixpkgsCross.android.aarch64 - reflex-platform.nixpkgsCross.android.aarch32 - ] + reflex-platform.nixpkgsCross.ios.aarch64 + reflex-platform.nixpkgsCross.android.aarch64 + reflex-platform.nixpkgsCross.android.aarch32 + ] ); drvListToAttrs = drvs: lib.listToAttrs (map (drv: { inherit (drv) name; value = drv; }) drvs); - perPlatform = lib.genAttrs cacheBuildSystems (system: let - getRP = args: import ./. ((self-args // { inherit system; }) // args); - reflex-platform = getRP {}; - reflex-platform-nojsstring = getRP { useTextJSString = false; }; + perPlatform = lib.genAttrs cacheBuildSystems (system: + let + getRP = args: import ./. ((self-args // { inherit system; }) // args); + reflex-platform = getRP { }; + reflex-platform-nojsstring = getRP { useTextJSString = false; }; - jsexeHydra = exe: exe.overrideAttrs (attrs: { - postInstall = '' - ${attrs.postInstall or ""} - mkdir -p $out/nix-support - echo $out/bin/reflex-todomvc.jsexe >> $out/nix-support/hydra-build-products - ''; - }); + jsexeHydra = exe: exe.overrideAttrs (attrs: { + postInstall = '' + ${attrs.postInstall or ""} + mkdir -p $out/nix-support + echo $out/bin/reflex-todomvc.jsexe >> $out/nix-support/hydra-build-products + ''; + }); - benchmark = import ./nix-utils/benchmark { inherit reflex-platform; }; - demoVM = import ./nix-utils/demo-vm { inherit reflex-platform; }; + benchmark = import ./nix-utils/benchmark { inherit reflex-platform; }; + demoVM = import ./nix-utils/demo-vm { inherit reflex-platform; }; - # TODO do we still need to do these to ensure srcs (only used at build time) - # make it to the cache? If not, we can just drop this and all the `_dep` - # attributes in the overlays. + # TODO do we still need to do these to ensure srcs (only used at build time) + # make it to the cache? If not, we can just drop this and all the `_dep` + # attributes in the overlays. - dep = {} - // reflex-platform.ghcjs8_6._dep - // (lib.optionalAttrs reflex-platform.androidSupport reflex-platform.ghcAndroidAarch64._dep) - // benchmark.dep + dep = { } + // reflex-platform.ghcjs8_6._dep + // (lib.optionalAttrs reflex-platform.androidSupport reflex-platform.ghcAndroidAarch64._dep) + // benchmark.dep ; - skeleton-test = import ./tests/skeleton.nix { inherit reflex-platform; }; + skeleton-test = import ./tests/skeleton.nix { inherit reflex-platform; }; - collect = v: - if lib.isDerivation v then [v] - else if lib.isAttrs v then lib.concatMap collect (builtins.attrValues v) - else if lib.isList v then lib.concatMap collect v - else []; + collect = v: + if lib.isDerivation v then [ v ] + else if lib.isAttrs v then lib.concatMap collect (builtins.attrValues v) + else if lib.isList v then lib.concatMap collect v + else [ ]; + + optDebugVariants = [ + "unprofiled" + "profiled" + ]; + perOptDebugVariant = lib.genAttrs optDebugVariants (variant: + let + reflex-platform = getRP { enableLibraryProfiling = variant == "profiled"; }; + skeleton-test = import ./tests/skeleton.nix { inherit reflex-platform; }; + otherDeps = getOtherDeps reflex-platform; + packages = { + # TODO uncomment this once GHCJS profiling builds are fixed + # tryReflexShell = reflex-platform.tryReflexShell; + ghc.ReflexTodomvc = reflex-platform.ghc.reflex-todomvc; + ghc8_6.reflexTodomvc = reflex-platform.ghc8_6.reflex-todomvc; + ghc8_10.reflexTodomvc = reflex-platform.ghc8_10.reflex-todomvc; + ghc.reflex-vty = reflex-platform.ghc.reflex-vty; + ghc.reflex-process = reflex-platform.ghc.reflex-process; + ghc.reflex-fsnotify = reflex-platform.ghc.reflex-fsnotify; + skeleton-test-ghc = skeleton-test.ghc; + } // lib.optionalAttrs (reflex-platform.androidSupport) { + inherit (reflex-platform) androidReflexTodomvc; + inherit (reflex-platform) androidReflexTodomvc-8_6; + inherit (reflex-platform) androidReflexTodomvc-8_10; + androidReflexTodomvc-release = reflex-platform.android.buildApp { + package = p: p.reflex-todomvc; + executableName = "reflex-todomvc"; + applicationId = "org.reflexfrp.todomvc"; + displayName = "Reflex TodoMVC"; + isRelease = true; + }; + skeleton-test-project-android = skeleton-test.project.android; + } // lib.optionalAttrs (reflex-platform.iosSupport) { + inherit (reflex-platform) iosReflexTodomvc; + inherit (reflex-platform) iosReflexTodomvc-8_6; + inherit (reflex-platform) iosReflexTodomvc-8_10; + inherit (reflex-platform) iosSimulatorReflexTodomvc; + skeleton-test-project-ios = skeleton-test.project.ios; + } // drvListToAttrs otherDeps + # TODO uncomment this once GHCJS profiling builds are fixed + # // drvListToAttrs (lib.filter lib.isDerivation reflex-platform.cachePackages) + ; + in + packages // { + cache = reflex-platform.pinBuildInputs "reflex-platform-${system}-${variant}" + (collect packages ++ otherDeps); + }); - optDebugVariants = [ - "unprofiled" - "profiled" - ]; - perOptDebugVariant = lib.genAttrs optDebugVariants (variant: let - reflex-platform = getRP { enableLibraryProfiling = variant == "profiled"; }; - skeleton-test = import ./tests/skeleton.nix { inherit reflex-platform; }; - otherDeps = getOtherDeps reflex-platform; packages = { - # TODO uncomment this once GHCJS profiling builds are fixed - # tryReflexShell = reflex-platform.tryReflexShell; - ghc.ReflexTodomvc = reflex-platform.ghc.reflex-todomvc; - ghc8_6.reflexTodomvc = reflex-platform.ghc8_6.reflex-todomvc; - ghc8_10.reflexTodomvc = reflex-platform.ghc8_10.reflex-todomvc; - ghc.reflex-vty = reflex-platform.ghc.reflex-vty; - ghc.reflex-process = reflex-platform.ghc.reflex-process; - ghc.reflex-fsnotify = reflex-platform.ghc.reflex-fsnotify; - skeleton-test-ghc = skeleton-test.ghc; - } // lib.optionalAttrs (reflex-platform.androidSupport) { - inherit (reflex-platform) androidReflexTodomvc; - inherit (reflex-platform) androidReflexTodomvc-8_6; - inherit (reflex-platform) androidReflexTodomvc-8_10; - androidReflexTodomvc-release = reflex-platform.android.buildApp { - package = p: p.reflex-todomvc; - executableName = "reflex-todomvc"; - applicationId = "org.reflexfrp.todomvc"; - displayName = "Reflex TodoMVC"; - isRelease = true; + inherit dep; + tryReflexShell = reflex-platform.tryReflexShell; + ghcjs.reflexTodomvc = jsexeHydra reflex-platform.ghcjs.reflex-todomvc; + # TODO Doesn't currently build. Removing from CI until fixed. + ghcjs8_6.reflexTodomvc = jsexeHydra reflex-platform.ghcjs8_6.reflex-todomvc; + ghcjs8_10.reflexTodomvc = jsexeHydra reflex-platform.ghcjs8_10.reflex-todomvc; + # TODO move back to `perOptDebugVariant` + skeleton-test-ghcjs = skeleton-test.ghcjs; + nojsstring = { + ghcjs.reflexTodomvc = reflex-platform-nojsstring.ghcjs.reflex-todomvc; + ghcjs8_6.reflexTodomvc = reflex-platform-nojsstring.ghcjs8_6.reflex-todomvc; + ghcjs8_10.reflexTodomvc = reflex-platform-nojsstring.ghcjs8_10.reflex-todomvc; }; - skeleton-test-project-android = skeleton-test.project.android; - } // lib.optionalAttrs (reflex-platform.iosSupport) { - inherit (reflex-platform) iosReflexTodomvc; - inherit (reflex-platform) iosReflexTodomvc-8_6; - inherit (reflex-platform) iosReflexTodomvc-8_10; - inherit (reflex-platform) iosSimulatorReflexTodomvc; - skeleton-test-project-ios = skeleton-test.project.ios; - } // drvListToAttrs otherDeps - # TODO uncomment this once GHCJS profiling builds are fixed - # // drvListToAttrs (lib.filter lib.isDerivation reflex-platform.cachePackages) + } // lib.optionalAttrs (system == "x86_64-linux") { + inherit + benchmark + # demoVM # Skip for new due to rotted has in `breeze-icons` + ; + } # TODO move back to `perOptDebugVariant` + // drvListToAttrs (lib.filter lib.isDerivation reflex-platform.cachePackages) ; - in packages // { - cache = reflex-platform.pinBuildInputs "reflex-platform-${system}-${variant}" - (collect packages ++ otherDeps); + in + packages // perOptDebugVariant // { + cache = reflex-platform.pinBuildInputs "reflex-platform-${system}" + (collect packages ++ map (a: a.cache) (builtins.attrValues perOptDebugVariant)); }); - packages = { - inherit dep; - tryReflexShell = reflex-platform.tryReflexShell; - ghcjs.reflexTodomvc = jsexeHydra reflex-platform.ghcjs.reflex-todomvc; - # TODO Doesn't currently build. Removing from CI until fixed. - ghcjs8_6.reflexTodomvc = jsexeHydra reflex-platform.ghcjs8_6.reflex-todomvc; - ghcjs8_10.reflexTodomvc = jsexeHydra reflex-platform.ghcjs8_10.reflex-todomvc; - # TODO move back to `perOptDebugVariant` - skeleton-test-ghcjs = skeleton-test.ghcjs; - nojsstring = { - ghcjs.reflexTodomvc = reflex-platform-nojsstring.ghcjs.reflex-todomvc; - ghcjs8_6.reflexTodomvc = reflex-platform-nojsstring.ghcjs8_6.reflex-todomvc; - ghcjs8_10.reflexTodomvc = reflex-platform-nojsstring.ghcjs8_10.reflex-todomvc; - }; - } // lib.optionalAttrs (system == "x86_64-linux") { - inherit - benchmark - # demoVM # Skip for new due to rotted has in `breeze-icons` - ; - } # TODO move back to `perOptDebugVariant` - // drvListToAttrs (lib.filter lib.isDerivation reflex-platform.cachePackages) - ; - in packages // perOptDebugVariant // { - cache = reflex-platform.pinBuildInputs "reflex-platform-${system}" - (collect packages ++ map (a: a.cache) (builtins.attrValues perOptDebugVariant)); - }); - metaCache = local-self.pinBuildInputs "reflex-platform-everywhere" (map (a: a.cache) (builtins.attrValues perPlatform)); -in perPlatform // { inherit metaCache; } +in +perPlatform // { inherit metaCache; } From e343f42b7a47829ff7a7f90c30a9820989010d04 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Wed, 29 Jun 2022 12:12:23 -0500 Subject: [PATCH 07/11] Update splices-load-save.nix --- default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index 5bab57d2e..48d6fc93c 100644 --- a/default.nix +++ b/default.nix @@ -27,10 +27,9 @@ let splices-load-save-nix = nixpkgs.fetchFromGitHub { owner = "obsidiansystems"; repo = "splices-load-save.nix"; - rev = "7d51421ebb054ba86d890d7cac91bc8f91240148"; - sha256 = "sha256-gw1EwL5MqbVK0enGoD3hcRtRn7+6JAjmk4iF5HShH34="; + rev = "921812b408fb2ca3db72bb0e42d0655fbf28cbb0"; + sha256 = lib.fakeHash; }; - #splices-load-save-nix = ../splices-load-save.nix/default.nix; splices-src = import splices-load-save-nix { pkgs = nixpkgs; }; # Overlay for GHC which supports the external splices plugin From 7ba9e26a57c8897a9c3e4de09f66736899c0d6c9 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Wed, 29 Jun 2022 12:13:37 -0500 Subject: [PATCH 08/11] update hash for fetchFromGitHub --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 48d6fc93c..e10e050e6 100644 --- a/default.nix +++ b/default.nix @@ -28,7 +28,7 @@ let owner = "obsidiansystems"; repo = "splices-load-save.nix"; rev = "921812b408fb2ca3db72bb0e42d0655fbf28cbb0"; - sha256 = lib.fakeHash; + sha256 = "sha256-gSO+46bnyvFCG6fT5uLSSqUSfN+8t7pQnS2NBUlaRrM="; }; splices-src = import splices-load-save-nix { pkgs = nixpkgs; }; From 6365f1a3a81a04b57c0ea21df791ae36fdb224ef Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Wed, 29 Jun 2022 14:21:22 -0500 Subject: [PATCH 09/11] fixup --- default.nix | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/default.nix b/default.nix index e10e050e6..8bb170e00 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,8 @@ { nixpkgsFunc ? import ./nixpkgs , system ? builtins.currentSystem -, config ? { } +, config ? { + android_sdk.accept_license = true; + } , enableLibraryProfiling ? false , enableExposeAllUnfoldings ? true , enableTraceReflexEvents ? false @@ -27,7 +29,7 @@ let splices-load-save-nix = nixpkgs.fetchFromGitHub { owner = "obsidiansystems"; repo = "splices-load-save.nix"; - rev = "921812b408fb2ca3db72bb0e42d0655fbf28cbb0"; + rev = "2ec45a6382e1a09fb13531ad8af1ffca596458b3"; sha256 = "sha256-gSO+46bnyvFCG6fT5uLSSqUSfN+8t7pQnS2NBUlaRrM="; }; @@ -37,7 +39,11 @@ let haskell = super.haskell // { compiler = super.haskell.compiler // { ghcSplices-8_6 = (splices-src.patchGHC (super.haskell.compiler.ghc865) "ghc-8.6.5"); - ghcSplices-8_10 = (splices-src.patchGHC (super.haskell.compiler.ghc8107) "ghc-8.10.7"); + ghcSplices-8_10 = ((splices-src.patchGHC (super.haskell.compiler.ghc8107) "ghc-8.10.7").overrideAttrs (drv: { + patches = [ ] ++ (drv.patches or [ ]); + })).override { + enableProfiledLibs = true; + }; ghcjsSplices-8_10 = splices-src.patchGHCJS (super.haskell.compiler.ghcjs810); }; packages = super.haskell.packages // { @@ -83,7 +89,7 @@ let lib.optionalAttrs (self.stdenv.hostPlatform != self.stdenv.buildPlatform) { postInstall = " rm $out/include/libcharset.h $out/include/localcharset.h "; - configureFlags = [ " - -disable-shared " " - -enable-static " ]; + configureFlags = [ " --disable-shared " " --enable-static " ]; }); }; zlib = super.zlib.override (lib.optionalAttrs @@ -108,8 +114,7 @@ let ] ++ nixpkgsOverlays; config = config // { permittedInsecurePackages = (config.permittedInsecurePackages or [ ]) ++ [ - " - webkitgtk-2 .4 .11 " + "webkitgtk-2.4.11" ]; # XCode needed for native macOS app @@ -132,7 +137,7 @@ let aarch32 = { crossSystem = lib.systems.examples.armv7a-android-prebuilt // { # Choose an old version so it's easier to find phones to test on - sdkVer = " 23 "; + sdkVer = "23"; }; }; }; @@ -156,12 +161,7 @@ let }; }; # Back compat - arm64 = lib.warn " - nixpkgsCross.ios.arm64 - has - been - deprecated, using nixpkgsCross.ios.aarch64 instead." - aarch64; + arm64 = lib.warn "nixpkgsCross.ios.arm64 has been deprecated, using nixpkgsCross.ios.aarch64 instead." aarch64; }; ghcjs = nixpkgsFunc (nixpkgsArgs // { crossSystem = lib.systems.examples.ghcjs; @@ -182,8 +182,7 @@ let # function which takes the old argument set and combining it. What a tongue # twister! - cabal2nixResult = src: builtins.trace "cabal2nixResult is deprecated; - use ghc.haskellSrc2nix or ghc.callCabal2nix instead" + cabal2nixResult = src: builtins.trace "cabal2nixResult is deprecated; use ghc.haskellSrc2nix or ghc.callCabal2nix instead" (ghc.haskellSrc2nix { name = "for-unknown-package"; src = "file://${src}"; From d77247ad3e29178889e7d7bca960ac733798cfae Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Wed, 29 Jun 2022 15:15:21 -0500 Subject: [PATCH 10/11] more fixes --- default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/default.nix b/default.nix index 8bb170e00..38221ce38 100644 --- a/default.nix +++ b/default.nix @@ -38,12 +38,18 @@ let splicesEval = self: super: { haskell = super.haskell // { compiler = super.haskell.compiler // { - ghcSplices-8_6 = (splices-src.patchGHC (super.haskell.compiler.ghc865) "ghc-8.6.5"); - ghcSplices-8_10 = ((splices-src.patchGHC (super.haskell.compiler.ghc8107) "ghc-8.10.7").overrideAttrs (drv: { - patches = [ ] ++ (drv.patches or [ ]); - })).override { - enableProfiledLibs = true; - }; + ghcSplices-8_6 = (splices-src.patchGHC + (super.haskell.compiler.ghc865.overrideAttrs (old: { + enableParallelBuilding = false; + patches = [ ]; + })) "ghc-8.6.5"); + + ghcSplices-8_10 = (splices-src.patchGHC + (super.haskell.compiler.ghc8107.overrideAttrs (old: { + patches = [ ]; + })) "ghc-8.10.7").override + { enableProfiledLibs = true; }; + ghcjsSplices-8_10 = splices-src.patchGHCJS (super.haskell.compiler.ghcjs810); }; packages = super.haskell.packages // { From 7712970363b2a729ba0c0cd1d6b3746129b08032 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Thu, 30 Jun 2022 07:11:54 -0500 Subject: [PATCH 11/11] Update splices-load-save.nix to fix ghc 8.6.5 --- default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 38221ce38..c724c3318 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,8 @@ { nixpkgsFunc ? import ./nixpkgs , system ? builtins.currentSystem , config ? { - android_sdk.accept_license = true; + # Accept license to build android apps + #android_sdk.accept_license = true; } , enableLibraryProfiling ? false , enableExposeAllUnfoldings ? true @@ -29,10 +30,9 @@ let splices-load-save-nix = nixpkgs.fetchFromGitHub { owner = "obsidiansystems"; repo = "splices-load-save.nix"; - rev = "2ec45a6382e1a09fb13531ad8af1ffca596458b3"; - sha256 = "sha256-gSO+46bnyvFCG6fT5uLSSqUSfN+8t7pQnS2NBUlaRrM="; + rev = "5f8c1cea99ca6a8a871c7bdd26b709b59efa0534"; + sha256 = "sha256-4TusDSv4tQOLtfuDZnfJrdg41MXGx6+mOzl6NwycRxY="; }; - splices-src = import splices-load-save-nix { pkgs = nixpkgs; }; # Overlay for GHC which supports the external splices plugin splicesEval = self: super: {