From 07941c022888d9042ae0789791eb78d9714dd228 Mon Sep 17 00:00:00 2001 From: Douglas Burke Date: Mon, 26 Jun 2023 13:34:46 -0400 Subject: [PATCH 1/4] Bump stackage versions The nightly version, which tracks GHC 9.6, is untested --- hvega/stack-9.0.yaml | 2 +- hvega/stack-9.2.yaml | 2 +- hvega/stack-nightly.yaml | 8 ++++++++ hvega/stack.yaml | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 hvega/stack-nightly.yaml diff --git a/hvega/stack-9.0.yaml b/hvega/stack-9.0.yaml index cf640adb..db67c2d1 100644 --- a/hvega/stack-9.0.yaml +++ b/hvega/stack-9.0.yaml @@ -5,4 +5,4 @@ packages: extra-deps: [] -resolver: lts-19.11 +resolver: lts-19.33 diff --git a/hvega/stack-9.2.yaml b/hvega/stack-9.2.yaml index ecc6cdd4..308676c2 100644 --- a/hvega/stack-9.2.yaml +++ b/hvega/stack-9.2.yaml @@ -5,4 +5,4 @@ packages: extra-deps: [] -resolver: nightly-2022-06-15 +resolver: lts-20.26 diff --git a/hvega/stack-nightly.yaml b/hvega/stack-nightly.yaml new file mode 100644 index 00000000..23b750bc --- /dev/null +++ b/hvega/stack-nightly.yaml @@ -0,0 +1,8 @@ +flags: {} + +packages: +- . + +extra-deps: [] + +resolver: nightly-2023-06-26 diff --git a/hvega/stack.yaml b/hvega/stack.yaml index 203bea6d..30edbc54 100644 --- a/hvega/stack.yaml +++ b/hvega/stack.yaml @@ -5,4 +5,4 @@ packages: extra-deps: [] -resolver: lts-18.28 +resolver: lts-21.0 From 1ee8f4eca43ecb3b124ffb7442e307d508ff8b0d Mon Sep 17 00:00:00 2001 From: Douglas Burke Date: Mon, 26 Jun 2023 13:46:13 -0400 Subject: [PATCH 2/4] niv: update nix versions --- nix/sources.json | 20 ++++---- nix/sources.nix | 118 ++++++++++++++++++++++++++++------------------- 2 files changed, 81 insertions(+), 57 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index 5484d7ad..9322c8c1 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": null, "owner": "gibiansky", "repo": "IHaskell", - "rev": "7e69c7e176ba234d29a57fcdff8d1bba04e34ab4", - "sha256": "0ry2l1g5z04n5l3991p361fs9andbr7disiwamx09sbx0cn7wwm2", + "rev": "c547ee2fdc0a09cf4129b19292147fec38527a55", + "sha256": "0ail2r2kn1zlsny6f4sjrw6zs9kfj69ip82cf46da7kn2rv155cn", "type": "tarball", - "url": "https://github.com/gibiansky/IHaskell/archive/7e69c7e176ba234d29a57fcdff8d1bba04e34ab4.tar.gz", + "url": "https://github.com/gibiansky/IHaskell/archive/c547ee2fdc0a09cf4129b19292147fec38527a55.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "niv": { @@ -17,22 +17,22 @@ "homepage": "https://github.com/nmattia/niv", "owner": "nmattia", "repo": "niv", - "rev": "5830a4dd348d77e39a0f3c4c762ff2663b602d4c", - "sha256": "1d3lsrqvci4qz2hwjrcnd8h5vfkg8aypq3sjd4g3izbc8frwz5sm", + "rev": "914aba08a26cb10538b84d00d6cfb01c9776d80c", + "sha256": "0gx316gc7prjay5b0cr13x4zc2pdbiwxkfkpjvrlb2rml80lm4pm", "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/5830a4dd348d77e39a0f3c4c762ff2663b602d4c.tar.gz", + "url": "https://github.com/nmattia/niv/archive/914aba08a26cb10538b84d00d6cfb01c9776d80c.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "release-21.11", + "branch": "release-23.05", "description": "Nix Packages collection", "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "93a707704d0ba1316cd01a205c3163e764f05fad", - "sha256": "0wd54yc2yih3h43rzyb2k7xj58gnk3wi2lpjh3pgnrq4xmlnvfnl", + "rev": "09798f0dd4c11b431765275893d9d395c1e203b8", + "sha256": "0722086ipwl49a1dxqc4clz3yqa7086a41ya3f2hf67gnnk4xr7q", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/93a707704d0ba1316cd01a205c3163e764f05fad.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/09798f0dd4c11b431765275893d9d395c1e203b8.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/nix/sources.nix b/nix/sources.nix index 1938409d..fe3dadf7 100644 --- a/nix/sources.nix +++ b/nix/sources.nix @@ -10,29 +10,50 @@ let let name' = sanitizeName name + "-src"; in - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; name = name'; } - else - pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; + if spec.builtin or true then + builtins_fetchurl { inherit (spec) url sha256; name = name'; } + else + pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; fetch_tarball = pkgs: name: spec: let name' = sanitizeName name + "-src"; in - if spec.builtin or true then - builtins_fetchTarball { name = name'; inherit (spec) url sha256; } - else - pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; + if spec.builtin or true then + builtins_fetchTarball { name = name'; inherit (spec) url sha256; } + else + pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; fetch_git = name: spec: let ref = - if spec ? ref then spec.ref else + spec.ref or ( if spec ? branch then "refs/heads/${spec.branch}" else - if spec ? tag then "refs/tags/${spec.tag}" else - abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; + if spec ? tag then "refs/tags/${spec.tag}" else + abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!" + ); + submodules = spec.submodules or false; + submoduleArg = + let + nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0; + emptyArgWithWarning = + if submodules + then + builtins.trace + ( + "The niv input \"${name}\" uses submodules " + + "but your nix's (${builtins.nixVersion}) builtins.fetchGit " + + "does not support them" + ) + { } + else { }; + in + if nixSupportsSubmodules + then { inherit submodules; } + else emptyArgWithWarning; in - builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }; + builtins.fetchGit + ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg); fetch_local = spec: spec.path; @@ -66,16 +87,16 @@ let hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; hasThisAsNixpkgsPath = == ./.; in - if builtins.hasAttr "nixpkgs" sources - then sourcesNixpkgs - else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then - import {} - else - abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; + if builtins.hasAttr "nixpkgs" sources + then sourcesNixpkgs + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then + import { } + else + abort + '' + Please specify either (through -I or NIX_PATH=nixpkgs=...) or + add a package called "nixpkgs" to your sources.json. + ''; # The actual fetching function. fetch = pkgs: name: spec: @@ -95,13 +116,13 @@ let # the path directly as opposed to the fetched source. replace = name: drv: let - saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; in - if ersatz == "" then drv else - # this turns the string into an actual Nix path (for both absolute and - # relative paths) - if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; + if ersatz == "" then drv else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; # Ports of functions for older nix versions @@ -112,7 +133,7 @@ let ); # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); + range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); @@ -123,43 +144,46 @@ let concatStrings = builtins.concatStringsSep ""; # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 - optionalAttrs = cond: as: if cond then as else {}; + optionalAttrs = cond: as: if cond then as else { }; # fetchTarball version that is compatible between all the versions of Nix builtins_fetchTarball = { url, name ? null, sha256 }@attrs: let inherit (builtins) lessThan nixVersion fetchTarball; in - if lessThan nixVersion "1.12" then - fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchTarball attrs; + if lessThan nixVersion "1.12" then + fetchTarball ({ inherit url; } // (optionalAttrs (name != null) { inherit name; })) + else + fetchTarball attrs; # fetchurl version that is compatible between all the versions of Nix builtins_fetchurl = { url, name ? null, sha256 }@attrs: let inherit (builtins) lessThan nixVersion fetchurl; in - if lessThan nixVersion "1.12" then - fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchurl attrs; + if lessThan nixVersion "1.12" then + fetchurl ({ inherit url; } // (optionalAttrs (name != null) { inherit name; })) + else + fetchurl attrs; # Create the final "sources" from the config mkSources = config: - mapAttrs ( - name: spec: - if builtins.hasAttr "outPath" spec - then abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = replace name (fetch config.pkgs name spec); } - ) config.sources; + mapAttrs + ( + name: spec: + if builtins.hasAttr "outPath" spec + then + abort + "The values in sources.json should not have an 'outPath' attribute" + else + spec // { outPath = replace name (fetch config.pkgs name spec); } + ) + config.sources; # The "config" used by the fetchers mkConfig = { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null - , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) + , sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile) , system ? builtins.currentSystem , pkgs ? mkPkgs sources system }: rec { @@ -171,4 +195,4 @@ let }; in -mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } +mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); } From 2470d2a956672a7d9ef5f14be6300703b61c56d6 Mon Sep 17 00:00:00 2001 From: Douglas Burke Date: Mon, 26 Jun 2023 16:23:22 -0400 Subject: [PATCH 3/4] nix: update to ghc 9.2.8/nixpkgs 23.05 --- default.nix | 2 +- hvega/default.nix | 4 ++-- hvega/shell.nix | 2 +- ihaskell-hvega/default.nix | 2 +- ihaskell-hvega/shell.nix | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/default.nix b/default.nix index 7d63caff..4cfd08be 100644 --- a/default.nix +++ b/default.nix @@ -15,7 +15,7 @@ let ihaskell-hvega = ps.callCabal2nix "ihaskell-hvega" (gitignore ihaskellvegaDir) {}; in import "${sources.IHaskell}/release.nix" { - compiler = "ghc8107"; + compiler = "ghc8107"; # what version is supported nowadays? nixpkgs = pkgs; # packages = p: [ hvega ihaskell-hvega ]; packages = p: [ hvega ihaskell-hvega p.aeson p.aeson-pretty p.Frames p.foldl p.formatting p.microlens ]; diff --git a/hvega/default.nix b/hvega/default.nix index b3e7d1d9..3eafa0f4 100644 --- a/hvega/default.nix +++ b/hvega/default.nix @@ -1,13 +1,13 @@ { sources ? import ../nix/sources.nix , pkgs ? import sources.nixpkgs {} -, compiler ? "ghc8107" +, compiler ? "ghc928" }: let # There must be a better way than this! I just want to avoid # excessive compilation when using a non-standard compiler. # - isDefaultCompiler = compiler == "ghc8107"; + isDefaultCompiler = compiler == "ghc8107"; # drop HLS for now # since we are in a sub-directory # gitignore = pkgs.nix-gitignore.gitignoreSourcePure [ ./.gitignore ]; diff --git a/hvega/shell.nix b/hvega/shell.nix index 9cdb2b40..61cd4983 100644 --- a/hvega/shell.nix +++ b/hvega/shell.nix @@ -1,3 +1,3 @@ -{ compiler ? "ghc8107" +{ compiler ? "ghc928" }: (import ./default.nix { compiler = compiler; }).shell diff --git a/ihaskell-hvega/default.nix b/ihaskell-hvega/default.nix index 54d48c1f..e6d4fd28 100644 --- a/ihaskell-hvega/default.nix +++ b/ihaskell-hvega/default.nix @@ -1,6 +1,6 @@ { sources ? import ../nix/sources.nix , pkgs ? import sources.nixpkgs {} -, compiler ? "ghc8107" +, compiler ? "ghc928" }: let diff --git a/ihaskell-hvega/shell.nix b/ihaskell-hvega/shell.nix index 9cdb2b40..61cd4983 100644 --- a/ihaskell-hvega/shell.nix +++ b/ihaskell-hvega/shell.nix @@ -1,3 +1,3 @@ -{ compiler ? "ghc8107" +{ compiler ? "ghc928" }: (import ./default.nix { compiler = compiler; }).shell From 285f02aa9b100e8de682b9aae1117d66e19de8f1 Mon Sep 17 00:00:00 2001 From: Douglas Burke Date: Mon, 26 Jun 2023 17:01:51 -0400 Subject: [PATCH 4/4] CI: try to update --- .github/workflows/hvega-ci.yml | 45 ++++++++++++---------------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/.github/workflows/hvega-ci.yml b/.github/workflows/hvega-ci.yml index 89228a1c..7683ae2a 100644 --- a/.github/workflows/hvega-ci.yml +++ b/.github/workflows/hvega-ci.yml @@ -23,38 +23,22 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] cabal: ["latest"] - ghc: - - "8.4" - - "8.6" - - "8.8" - - "8.10" - - "9.0" - - "9.2" - exclude: - - os: macOS-latest - ghc: 8.4 - - os: macOS-latest - ghc: 8.6 - - os: macOS-latest - ghc: 8.8 - - os: macOS-latest - ghc: 9.2 - - os: windows-latest - ghc: 8.4 - - os: windows-latest - ghc: 8.6 - - os: windows-latest - ghc: 8.8 - - os: windows-latest - ghc: 9.2 + + os: [ubuntu-latest] + ghc-version: ["9.6", "9.4", "9.2", "9.0", "8.10"] + + include: + - os: macOS-latest + ghc-version: '9.4' + - os: windows-latest + ghc-version: '9.4' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main' - - uses: haskell/actions/setup@v1 + - uses: haskell/actions/setup@v2 id: setup-haskell-cabal name: Setup Haskell with: @@ -107,16 +91,17 @@ jobs: strategy: matrix: stack: ["latest"] - ghc: ["8.10"] + ghc: ["9.4"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main' - - uses: haskell/actions/setup@v1 + - uses: haskell/actions/setup@v2 name: Setup Haskell Stack with: ghc-version: ${{ matrix.ghc }} + enable-stack: true stack-version: ${{ matrix.stack }} - uses: actions/cache@v2.1.3