From b05c2b516cf586b2477ee1825b29c5cdbca59dff Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Sun, 15 Sep 2024 17:22:33 +0100 Subject: [PATCH] try to permit building with GHC 9.6 --- flake.lock | 36 ++++++++++++++------------------ flake.nix | 46 ++++++++++++++++++++++++++++++++++++----- fortran-src.cabal | 20 +++++++++--------- haskell-flake-ghc92.nix | 30 +++++++++++++++++++++++++++ haskell-flake-ghc94.nix | 30 +++++++++++++++++++++++++++ package.yaml | 9 ++++---- 6 files changed, 131 insertions(+), 40 deletions(-) create mode 100644 haskell-flake-ghc92.nix create mode 100644 haskell-flake-ghc94.nix diff --git a/flake.lock b/flake.lock index 8c181208..bb7eacf3 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1685662779, - "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "lastModified": 1726153070, + "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1687375904, - "narHash": "sha256-cBLffqOaf77zj+d/zYL27ti4MX7mOCTMrJrue7l5Muk=", + "lastModified": 1725811060, + "narHash": "sha256-lmPoWYNT8kI8LSTa0Z3id38SoR05+05IEZ3fxeIwOzE=", "owner": "srid", "repo": "haskell-flake", - "rev": "ab43c9d07efeaaeafd89c0ba371651340b52147d", + "rev": "9b490fe01ec8f6858f43d3cc81bfbbd0000eb29e", "type": "github" }, "original": { @@ -35,11 +35,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1687488839, - "narHash": "sha256-7JDjuyHwUvGJJge9jxfRJkuYyL5G5yipspc4J3HwjGA=", + "lastModified": 1726042813, + "narHash": "sha256-LnNKCCxnwgF+575y0pxUdlGZBO/ru1CtGHIqQVfvjlA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f9e94676ce6c7531c44d38da61d2669ebec0f603", + "rev": "159be5db480d1df880a0135ca0bfed84c2f88353", "type": "github" }, "original": { @@ -51,20 +51,14 @@ }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1685564631, - "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", - "type": "github" + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" } }, "root": { diff --git a/flake.nix b/flake.nix index db910f0e..d38c33e0 100644 --- a/flake.nix +++ b/flake.nix @@ -4,13 +4,49 @@ flake-parts.url = "github:hercules-ci/flake-parts"; haskell-flake.url = "github:srid/haskell-flake"; }; - outputs = inputs@{ self, nixpkgs, flake-parts, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - systems = nixpkgs.lib.systems.flakeExposed; + outputs = inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = inputs.nixpkgs.lib.systems.flakeExposed; imports = [ inputs.haskell-flake.flakeModule ]; perSystem = { self', pkgs, config, ... }: { - packages.default = self'.packages.fortran-src; - haskellProjects.default = {}; + packages.default = self'.packages.fortran-src-ghc92-fortran-src; + devShells.default = self'.devShells.fortran-src-ghc92; + + haskellProjects.ghc92 = import ./haskell-flake-ghc92.nix pkgs; + haskellProjects.fortran-src-ghc92 = { + basePackages = config.haskellProjects.ghc92.outputs.finalPackages; + devShell = { + tools = hp: { + # use nixpkgs cabal-install + cabal-install = pkgs.cabal-install; + + # disable these while unused (often slow/annoying to build) + haskell-language-server = null; + ghcid = null; + hlint = null; + }; + }; + }; + + haskellProjects.ghc94 = import ./haskell-flake-ghc94.nix pkgs; + haskellProjects.fortran-src-ghc94 = { + basePackages = config.haskellProjects.ghc94.outputs.finalPackages; + devShell = { + tools = hp: { + # use nixpkgs cabal-install + cabal-install = pkgs.cabal-install; + + # disable these while unused (often slow/annoying to build) + haskell-language-server = null; + ghcid = null; + hlint = null; + }; + }; + }; + + haskellProjects.ghc96 = { + basePackages = pkgs.haskell.packages.ghc96; + }; }; }; } diff --git a/fortran-src.cabal b/fortran-src.cabal index 60a118cb..eb23f0a3 100644 --- a/fortran-src.cabal +++ b/fortran-src.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.37.0. +-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack @@ -200,9 +200,9 @@ library , mtl >=2.2 && <3 , pretty >=1.1 && <2 , process >=1.2.0.0 - , singletons >=3.0 && <3.2 - , singletons-base >=3.0 && <3.2 - , singletons-th >=3.0 && <3.2 + , singletons ==3.0.* + , singletons-base >=3.0 && <3.3 + , singletons-th >=3.0 && <3.3 , temporary >=1.2 && <1.4 , text >=1.2 && <2.1 , uniplate >=1.6 && <2 @@ -264,9 +264,9 @@ executable fortran-src , mtl >=2.2 && <3 , pretty >=1.1 && <2 , process >=1.2.0.0 - , singletons >=3.0 && <3.2 - , singletons-base >=3.0 && <3.2 - , singletons-th >=3.0 && <3.2 + , singletons ==3.0.* + , singletons-base >=3.0 && <3.3 + , singletons-th >=3.0 && <3.3 , temporary >=1.2 && <1.4 , text >=1.2 && <2.1 , uniplate >=1.6 && <2 @@ -363,9 +363,9 @@ test-suite spec , mtl >=2.2 && <3 , pretty >=1.1 && <2 , process >=1.2.0.0 - , singletons >=3.0 && <3.2 - , singletons-base >=3.0 && <3.2 - , singletons-th >=3.0 && <3.2 + , singletons ==3.0.* + , singletons-base >=3.0 && <3.3 + , singletons-th >=3.0 && <3.3 , temporary >=1.2 && <1.4 , text >=1.2 && <2.1 , uniplate >=1.6 && <2 diff --git a/haskell-flake-ghc92.nix b/haskell-flake-ghc92.nix new file mode 100644 index 00000000..67443517 --- /dev/null +++ b/haskell-flake-ghc92.nix @@ -0,0 +1,30 @@ +pkgs: { + # disable local project options (always do this for package sets) + defaults.packages = {}; + devShell.enable = false; + autoWire = []; + + basePackages = pkgs.haskell.packages.ghc92; + packages = { + # GHC 9.2 libraries + singletons-th.source = "3.1"; + singletons-base.source = "3.1"; + singletons.source = "3.0.1"; # req because singletons-th-3.1 had bad bounds + th-desugar.source = "1.13.1"; + th-abstraction.source = "0.4.5.0"; + }; + + # (note this is actually unused/we have to duplicate because it doesn't get + # packed into basePackages or any key we can use... but nice to document here) + devShell = { + tools = hp: { + # by default, haskell-flake uses the Haskell packages versions of these + # tools (from hp). be warned, these can be a pain to build alternatively, + # you may use nixpkgs versions via pkgs + + # as of 2024-09-13 nixpkgs-unstable can't build cabal-install on GHC 9.2. + # no problem, use nixpkgs version (shouldn't really matter how built) + cabal-install = pkgs.cabal-install; + }; + }; +} diff --git a/haskell-flake-ghc94.nix b/haskell-flake-ghc94.nix new file mode 100644 index 00000000..6ebf68e8 --- /dev/null +++ b/haskell-flake-ghc94.nix @@ -0,0 +1,30 @@ +pkgs: { + # disable local project options (always do this for package sets) + defaults.packages = {}; + devShell.enable = false; + autoWire = []; + + basePackages = pkgs.haskell.packages.ghc94; + packages = { + # GHC 9.4 libraries + singletons-th.source = "3.1.1"; + singletons-base.source = "3.1.1"; + #singletons.source = "3.0.1"; + th-desugar.source = "1.14"; + th-abstraction.source = "0.4.5.0"; + }; + + # (note this is actually unused/we have to duplicate because it doesn't get + # packed into basePackages or any key we can use... but nice to document here) + devShell = { + tools = hp: { + # by default, haskell-flake uses the Haskell packages versions of these + # tools (from hp). be warned, these can be a pain to build alternatively, + # you may use nixpkgs versions via pkgs + + # as of 2024-09-13 nixpkgs-unstable can't build cabal-install on GHC 9.4. + # no problem, use nixpkgs version (shouldn't really matter how built) + cabal-install = pkgs.cabal-install; + }; + }; +} diff --git a/package.yaml b/package.yaml index 5f5f04b6..cc6e6624 100644 --- a/package.yaml +++ b/package.yaml @@ -99,10 +99,11 @@ dependencies: - either ^>=5.0.1.1 - process >= 1.2.0.0 -# 3.0 requires GHC 9.0; 3.1 requires GHC 9.2 -- singletons >= 3.0 && < 3.2 -- singletons-th >= 3.0 && < 3.2 -- singletons-base >= 3.0 && < 3.2 +- singletons >= 3.0 && < 3.1 + +# 3.0 = GHC 9.0, 3.1 = GHC 9.2, 3.1.1 = GHC 9.4, 3.2 = GHC 9.6 +- singletons-th >= 3.0 && < 3.3 +- singletons-base >= 3.0 && < 3.3 library: source-dirs: src