From 5a622db103630962ca316e4ee6625ad68abf9905 Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Wed, 27 Jul 2016 14:28:31 -0400 Subject: [PATCH] ghcjs: move list of stage 1 packages into ghcjs derivation This makes it easier to ensure that the list of stage 1 packages accurately matches the given version of ghcjs, and makes it possible for this list to be overridden --- pkgs/development/compilers/ghcjs/default.nix | 27 ++++++++++++++ .../haskell-modules/configuration-ghcjs.nix | 36 +++++-------------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/pkgs/development/compilers/ghcjs/default.nix b/pkgs/development/compilers/ghcjs/default.nix index f677cd77122..c6607906f73 100644 --- a/pkgs/development/compilers/ghcjs/default.nix +++ b/pkgs/development/compilers/ghcjs/default.nix @@ -136,6 +136,33 @@ in mkDerivation (rec { isGhcjs = true; inherit nodejs ghcjsBoot; inherit (ghcjsNodePkgs) "socket.io"; + + # This is the list of the Stage 1 packages that are built into a booted ghcjs installation + # It can be generated with the command: + # nix-shell -p haskell.packages.ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/^\([^_]*\)\(.*\)$/ \"\1\"/'" + stage1Packages = [ + "array" + "base" + "binary" + "rts" + "bytestring" + "containers" + "deepseq" + "directory" + "filepath" + "ghc-prim" + "ghcjs-prim" + "integer-gmp" + "old-locale" + "pretty" + "primitive" + "process" + "template-haskell" + "time" + "transformers" + "unix" + ]; + mkStage2 = import ./stage2.nix { inherit ghcjsBoot; }; diff --git a/pkgs/development/haskell-modules/configuration-ghcjs.nix b/pkgs/development/haskell-modules/configuration-ghcjs.nix index fffe29b1bc3..1feaa2a977b 100644 --- a/pkgs/development/haskell-modules/configuration-ghcjs.nix +++ b/pkgs/development/haskell-modules/configuration-ghcjs.nix @@ -8,10 +8,14 @@ in with import ./lib.nix { inherit pkgs; }; self: super: - # The stage 2 packages. Regenerate with ./ghcjs/gen-stage2.rb - let stage2 = super.ghc.mkStage2 { - inherit (self) callPackage; - }; in stage2 // { + + let # The stage 1 packages + stage1 = pkgs.lib.genAttrs super.ghc.stage1Packages (pkg: null); + # The stage 2 packages. Regenerate with ../compilers/ghcjs/gen-stage2.rb + stage2 = super.ghc.mkStage2 { + inherit (self) callPackage; + }; + in stage1 // stage2 // { old-time = overrideCabal stage2.old-time (drv: { postPatch = '' @@ -30,30 +34,6 @@ self: super: inherit (self.ghc.bootPkgs) jailbreak-cabal alex happy gtk2hs-buildtools rehoo hoogle; - # This is the list of the Stage 1 packages that are built into a booted ghcjs installation - # It can be generated with the command: - # nix-shell -p haskell.packages.ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/-\(.\)/\U\1/' | sed 's/^\([^_]*\)\(.*\)$/\1 = null;/'" - array = null; - base = null; - binary = null; - rts = null; - bytestring = null; - containers = null; - deepseq = null; - directory = null; - filepath = null; - ghc-prim = null; - ghcjs-prim = null; - integer-gmp = null; - old-locale = null; - pretty = null; - primitive = null; - process = null; - template-haskell = null; - time = null; - transformers = null; - unix = null; - # Don't set integer-simple to null! # GHCJS uses integer-gmp, so any package expression that depends on # integer-simple is wrong.