From daf7fc9fcce7554aa9493109ae0ef77226b0626b Mon Sep 17 00:00:00 2001 From: ners Date: Sun, 4 Feb 2024 13:15:53 +0100 Subject: [PATCH] add GHC 9.8 --- .github/workflows/ci.yml | 15 ++++---- .github/workflows/release.yml | 26 +++++++++----- flake.lock | 31 ++++------------- flake.nix | 65 +++++++++++++++++++---------------- 4 files changed, 68 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f0dc22..da28f6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,21 +4,24 @@ on: branches: master pull_request: branches: master + workflow_call: jobs: build: - name: Nix build + name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v24 + - uses: cachix/install-nix-action@v25 - uses: ryanccn/attic-action@v0 with: endpoint: https://cache.ners.ch cache: haskell token: ${{ secrets.ATTIC_TOKEN }} - name: Nix check - run: | - nix flake check \ - --accept-flake-config \ - --print-build-logs + run: nix flake check --accept-flake-config + - name: Nix build + run: nix build --accept-flake-config + - uses: actions/upload-artifact@v4 + with: + path: ./result diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f88592a..5e09721 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,23 @@ -name: "Release" +name: Release on: - push: - tags: - - v** + release: + types: + - published + jobs: + build: + name: CI + uses: ./.github/workflows/ci.yml release: + name: Release + needs: + - build runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Hackage release - uses: cachix/haskell-release-action@v1 + - uses: actions/download-artifact@v4 + - uses: haskell-actions/hackage-publish@v1 with: - - hackage-token: ${{ secrets.HACKAGE_AUTH_TOKEN }} + hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }} + docsPath: ./artifact/docs + packagesPath: ./artifact/sdist + publish: true diff --git a/flake.lock b/flake.lock index 1ae68d8..755da36 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nix-filter": { "locked": { - "lastModified": 1701697642, - "narHash": "sha256-L217WytWZHSY8GW9Gx1A64OnNctbuDbfslaTEofXXRw=", + "lastModified": 1705332318, + "narHash": "sha256-kcw1yFeJe9N4PjQji9ZeX47jg0p9A0DuU4djKvg1a7I=", "owner": "numtide", "repo": "nix-filter", - "rev": "c843418ecfd0344ecb85844b082ff5675e02c443", + "rev": "3449dc925982ad46246cfc36469baf66e1b64f17", "type": "github" }, "original": { @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703438236, - "narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=", + "lastModified": 1706732774, + "narHash": "sha256-hqJlyJk4MRpcItGYMF+3uHe8HvxNETWvlGtLuVpqLU0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b", + "rev": "b8b232ae7b8b144397fdb12d20f592e5e7c1a64d", "type": "github" }, "original": { @@ -34,24 +34,7 @@ "root": { "inputs": { "nix-filter": "nix-filter", - "nixpkgs": "nixpkgs", - "unix-compat": "unix-compat" - } - }, - "unix-compat": { - "flake": false, - "locked": { - "lastModified": 1701861515, - "narHash": "sha256-bmAC5BD3pI2QhGlWedob7FWu3fNKhRlXcjxzb+3M6nE=", - "owner": "haskell-pkg-janitors", - "repo": "unix-compat", - "rev": "cf977e1818be3a08362ab43a78c5b84a4c5c9b2a", - "type": "github" - }, - "original": { - "owner": "haskell-pkg-janitors", - "repo": "unix-compat", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 0ee6cce..e79e646 100644 --- a/flake.nix +++ b/flake.nix @@ -4,14 +4,9 @@ extra-trusted-public-keys = "haskell:WskuxROW5pPy83rt3ZXnff09gvnu80yovdeKDw5Gi3o="; }; - inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nix-filter.url = "github:numtide/nix-filter"; - unix-compat = { - url = "github:haskell-pkg-janitors/unix-compat"; - flake = false; - }; }; outputs = inputs: @@ -25,46 +20,56 @@ ); hsSrc = pname: root: inputs.nix-filter { inherit root; - include = [ - "app" - "lib" - "src" - "test" - (inputs.nix-filter.lib.matchExt "cabal") - (inputs.nix-filter.lib.matchExt "md") + include = with inputs.nix-filter.lib; [ + (matchExt "cabal") + (matchExt "hs") + (matchExt "md") + isDirectory ]; }; + pname = "lsp-client"; + src = hsSrc pname ./.; + ghcs = [ "ghc92" "ghc94" "ghc96" "ghc98" ]; overlay = final: prev: { haskell = prev.haskell // { - packageOverrides = lib.composeExtensions prev.haskell.packageOverrides (hfinal: hprev: - with prev.haskell.lib.compose; - { - "${pname}" = hfinal.callCabal2nix pname (hsSrc pname ./.) { - unix-compat = hfinal.callCabal2nix "unix-compat" inputs.unix-compat { }; - }; - } - ); + packageOverrides = lib.composeExtensions + prev.haskell.packageOverrides + (hfinal: hprev: { + "${pname}" = hfinal.callCabal2nix pname src { }; + }); }; }; - pname = "lsp-client"; - ghcs = [ "ghc92" "ghc94" "ghc96" ]; in foreach inputs.nixpkgs.legacyPackages (system: pkgs': let pkgs = pkgs'.extend overlay; - hps = lib.filterAttrs (ghc: _: elem ghc ghcs) pkgs.haskell.packages; + hps = + lib.filterAttrs (ghc: _: elem ghc ghcs) pkgs.haskell.packages + // { default = pkgs.haskellPackages; }; + allPackages = + pkgs.symlinkJoin { + inherit name; + paths = map (hp: hp.${pname}) (attrValues hps); + }; + docs = pkgs.haskell.lib.documentationTarball hps.default.${pname}; + sdist = hps.default.cabalSdist { name = "${pname}.tar.gz"; inherit src; }; + inherit (hps.default.${pname}) name; + default = pkgs.runCommand name { } '' + mkdir $out + cd $out + mkdir docs sdist + ln -s ${allPackages} ${name} + ln -s ${docs}/*.tar.gz docs/ + ln -s ${sdist} sdist/${name}.tar.gz + ''; in { formatter.${system} = pkgs.nixpkgs-fmt; - legacyPackages.${system} = pkgs; - packages.${system}.default = pkgs.haskellPackages.${pname}; - checks.${system}.${pname} = pkgs.buildEnv { - name = pname; - paths = map (hp: hp.${pname}) (attrValues hps); - }; + legacyPackages.${system} = { inherit (pkgs) haskell haskellPackages; }; + packages.${system} = { inherit default; }; devShells.${system} = - foreach (hps // { default = pkgs.haskellPackages; }) (ghcName: hp: { + foreach hps (ghcName: hp: { ${ghcName} = hp.shellFor { packages = ps: [ ps.${pname} ]; nativeBuildInputs = with hp; [