Skip to content

Commit

Permalink
Use Latest Haskell.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishmack committed Jan 12, 2025
1 parent a5cd0b8 commit 13f688f
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 95 deletions.
5 changes: 1 addition & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ packages:
trace-resources
trace-forward

extra-packages: Cabal

program-options
ghc-options: -Werror

Expand All @@ -59,8 +57,7 @@ package plutus-scripts-bench

constraints:
, wai-extra < 3.1.15
, Cabal < 3.14


allow-newer:
, katip:Win32
, ekg-wai:time
Expand Down
113 changes: 54 additions & 59 deletions flake.lock

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

4 changes: 1 addition & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
flake = false;
};
haskellNix = {
# GHC 8.10.7 cross compilation for windows is broken in newer versions of haskell.nix.
# Unpin this once we no longer need GHC 8.10.7.
url = "github:input-output-hk/haskell.nix/cb139fa956158397aa398186bb32dd26f7318784";
url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.hackage.follows = "hackageNix";
};
Expand Down
54 changes: 27 additions & 27 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ let
({ lib, pkgs, ... }: {
packages.cardano-tracer.package.buildable = with pkgs.stdenv.hostPlatform; lib.mkForce (!isMusl);
packages.cardano-node-chairman.components.tests.chairman-tests.buildable = lib.mkForce pkgs.stdenv.hostPlatform.isUnix;
package-keys = ["plutus-tx-plugin"];
packages.plutus-tx-plugin.components.library.platforms = with lib.platforms; [ linux darwin ];
packages.tx-generator.package.buildable = with pkgs.stdenv.hostPlatform; !isMusl;

Expand Down Expand Up @@ -141,10 +142,6 @@ let
packages.unix-time.postPatch = ''
sed -i 's/mingwex//g' unix-time.cabal
'';
# For these two packages the custom setups fail, as we end up with multiple instances of
# lib:Cabal. Likely a haskell.nix bug.
packages.entropy.package.buildType = lib.mkForce "Simple";
packages.HsOpenSSL.package.buildType = lib.mkForce "Simple";
#packages.plutus-core.components.library.preBuild = ''
# export ISERV_ARGS="-v +RTS -Dl"
# export PROXY_ARGS=-v
Expand Down Expand Up @@ -218,6 +215,7 @@ let
in
{
# split data output for ekg to reduce closure size
package-keys = ["ekg"];
packages.ekg.components.library.enableSeparateDataOutput = true;
packages.cardano-node-chairman.components.tests.chairman-tests.build-tools =
lib.mkForce [
Expand Down Expand Up @@ -321,17 +319,18 @@ let
# <no location info>: error: ghc: ghc-iserv terminated (-11)
packages.plutus-core.components.library.ghcOptions = [ "-fexternal-interpreter" ];
})
({ lib, ... }@args: {
options.packages = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule (
{ config, lib, ... }:
lib.mkIf config.package.isLocal
{
configureFlags = [ "--ghc-option=-Werror"]
++ lib.optional (args.config.compiler.version == "8.10.7") "--ghc-option=-Wwarn=unused-packages";
}
));
};
({ config, lib, ... }@args: {
options.packages = lib.genAttrs config.package-keys (_:
lib.mkOption {
type = lib.types.submodule (
{ config, lib, ... }:
lib.mkIf config.package.isLocal
{
configureFlags = [ "--ghc-option=-Werror"]
++ lib.optional (args.config.compiler.version == "8.10.7") "--ghc-option=-Wwarn=unused-packages";
}
);
});
})
({ lib, pkgs, ... }: lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
# systemd can't be statically linked
Expand All @@ -341,18 +340,19 @@ let
})
# disable haddock
# Musl libc fully static build
({ lib, ... }: {
options.packages = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule (
{ config, lib, pkgs, ...}:
lib.mkIf (pkgs.stdenv.hostPlatform.isMusl && config.package.isLocal)
{
# Module options which adds GHC flags and libraries for a fully static build
enableShared = true; # TH code breaks if this is false.
enableStatic = true;
}
));
};
({ config, lib, ... }: {
options.packages = lib.genAttrs config.package-keys (_:
lib.mkOption {
type = lib.types.submodule (
{ config, lib, pkgs, ...}:
lib.mkIf (pkgs.stdenv.hostPlatform.isMusl && config.package.isLocal)
{
# Module options which adds GHC flags and libraries for a fully static build
enableShared = true; # TH code breaks if this is false.
enableStatic = true;
}
);
});
config =
lib.mkIf pkgs.stdenv.hostPlatform.isMusl
{
Expand Down
2 changes: 1 addition & 1 deletion nix/workbench/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let
# recover CHaP location from cardano's project
chap = cardanoNodeProject.args.inputMap."https://chap.intersectmbo.org/";
# build plan as computed by nix
nixPlanJson = cardanoNodeProject.plan-nix.json;
nixPlanJson = cardanoNodeProject.plan-nix + "/plan.json";

# Workbench derivation and functions to create derivations from `wb` commands.
##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion nix/workbench/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let
chap = project.args.inputMap."https://chap.intersectmbo.org/";

# build plan as computed by nix
nixPlanJson = project.plan-nix.json;
nixPlanJson = project.plan-nix + "/plan.json";

in project.shellFor {
name = "workbench-shell";
Expand Down

0 comments on commit 13f688f

Please sign in to comment.