Skip to content

Commit

Permalink
js: add unstable output, set nodejs to nodejs_21
Browse files Browse the repository at this point in the history
- This change aligns the ghc.nix nodejs version to the node version that
runs on GHC's CI. See commit 23d72bc7674e643c73256242ba781bea4aef4fb8 in
ci-images on the GHC gitlab instance.
  • Loading branch information
doyougnu committed Feb 7, 2024
1 parent c31bcab commit 4185bad
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
19 changes: 18 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
Expand All @@ -28,7 +29,7 @@
ghc-wasm-meta.url = "gitlab:ghc/ghc-wasm-meta?host=gitlab.haskell.org";
};

outputs = { nixpkgs, all-cabal-hashes, pre-commit-hooks, ghc-wasm-meta, ... }: with nixpkgs.lib; let
outputs = { nixpkgs, unstable, all-cabal-hashes, pre-commit-hooks, ghc-wasm-meta, ... }: with nixpkgs.lib; let
supportedSystems =
# allow nix flake show and nix flake check when passing --impure
if builtins.hasAttr "currentSystem" builtins
Expand All @@ -39,7 +40,7 @@
lib = { inherit supportedSystems perSystem; };

defaultSettings = system: {
inherit nixpkgs system;
inherit nixpkgs system unstable;
all-cabal-hashes = all-cabal-hashes.outPath;
inherit (ghc-wasm-meta.outputs.packages."${system}") wasi-sdk wasmtime;
};
Expand Down
12 changes: 8 additions & 4 deletions ghc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let
in
args@{ system ? builtins.currentSystem
, nixpkgs
, unstable
, all-cabal-hashes
, bootghc ? "ghc96"
, version ? "9.9"
Expand All @@ -31,7 +32,7 @@ args@{ system ? builtins.currentSystem
, withEMSDK ? false # load emscripten for js-backend
, withWasm ? false # load the toolchain for wasm backend
, withWasiSDK ? false # Backward compat synonym for withWasm.
, withFindNoteDef ? true # install a shell script `find_note_def`;
, withFindNoteDef ? true # install a shell script `find_note_def`;
# `find_note_def "Adding a language extension"`
# will point to the definition of the Note "Adding a language extension"
, wasi-sdk
Expand Down Expand Up @@ -72,6 +73,7 @@ let
};

pkgs = import nixpkgs { inherit system; overlays = [ overlay ]; };
u-pkgs = import unstable { inherit system; overlays = [ overlay ]; };
in

with pkgs;
Expand Down Expand Up @@ -99,6 +101,8 @@ let
fonts = pkgs.makeFontsConf { fontDirectories = [ pkgs.dejavu_fonts ]; };
docsPackages = if withDocs then [ python3Packages.sphinx ourtexlive ] else [ ];

our-emscripten = emscripten.overrideAttrs (old: { buildInputs = old.buildInputs ++ [ u-pkgs.nodejs_18 ]; });

depsSystem = with lib; (
[
autoconf
Expand All @@ -123,7 +127,7 @@ let
++ docsPackages
++ optional withLlvm llvmForGhc
++ optional withGrind valgrind
++ optional withEMSDK emscripten
++ optional withEMSDK our-emscripten
++ optionals withWasm' [ wasi-sdk wasmtime ]
++ optional withNuma numactl
++ optional withDwarf elfutils
Expand Down Expand Up @@ -257,8 +261,8 @@ hspkgs.shellFor rec {
export HAPPY=${happy}/bin/happy
export ALEX=${alex}/bin/alex
export CONFIGURE=./configure
${lib.optionalString withEMSDK "export EMSDK=${emscripten}"}
${lib.optionalString withEMSDK "export EMSDK_LLVM=${emscripten}/bin/emscripten-llvm"}
${lib.optionalString withEMSDK "export EMSDK=${our-emscripten}"}
${lib.optionalString withEMSDK "export EMSDK_LLVM=${our-emscripten}/bin/emscripten-llvm"}
${ # prevents sub word sized atomic operations not available issues
# see: https://gitlab.haskell.org/ghc/ghc/-/wikis/javascript-backend/building#configure-fails-with-sub-word-sized-atomic-operations-not-available
lib.optionalString withEMSDK ''
Expand Down

0 comments on commit 4185bad

Please sign in to comment.