diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27023b8..b40e8ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,3 @@ -# The present workflow was made based on the following references: -# - https://github.com/actions/cache/blob/main/examples.md#haskell---cabal -# - https://github.com/haskell/time/blob/master/.github/workflows/ci.yml -# - https://github.com/stackbuilders/stache/blob/master/.github/workflows/ci.yaml -# - https://markkarpov.com/post/github-actions-for-haskell-ci.html --- name: Build @@ -15,31 +10,24 @@ concurrency: jobs: haskell: strategy: - fail-fast: true matrix: os: - macos-13 # x86_64-darwin - # - macos-latest # aarch64-darwin - # - ubuntu-latest # x86_64-linux - installable: - # - test-ghc8107 - - test-ghc902 # TODO: Rename package to test-ghc924 - # exclude: - # - os: ubuntu-latest - # installable: test-ghc902 + - macos-latest # aarch64-darwin + - ubuntu-latest # x86_64-linux + fail-fast: true runs-on: ${{ matrix.os }} timeout-minutes: 10 steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v12 with: - extra-conf: - accept-flake-config = true + extra-conf: accept-flake-config = true - uses: DeterminateSystems/magic-nix-cache-action@v7 - name: Compile code - run: nix build .#${{ matrix.installable }} + run: nix build .#test - name: Run tests - run: nix run .#${{ matrix.installable }} + run: nix run .#test docker: if: false diff --git a/flake.nix b/flake.nix index 7ee448d..99e590b 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ }; nixConfig = { - allow-import-from-derivation = true; + allow-import-from-derivation = "true"; extra-substituters = [ "https://cache.iog.io" ]; extra-trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; }; @@ -20,59 +20,41 @@ inherit (haskellNix) config; overlays = [ haskellNix.overlay - (final: prev: - let - mkCabalProject = compiler-nix-name: final.haskell-nix.cabalProject' { - inherit compiler-nix-name; - src = final.haskell-nix.haskellLib.cleanGit { - name = "hapistrano"; - src = ./.; - }; + (final: prev: { + hapistrano = final.haskell-nix.cabalProject' { + src = final.haskell-nix.haskellLib.cleanGit { + name = "hapistrano"; + src = ./.; }; - in - { - hapistrano-ghc8107 = mkCabalProject "ghc8107"; - hapistrano-ghc902 = mkCabalProject "ghc924"; - }) + compiler-nix-name = "ghc8107"; + }; + }) ]; }; - flake-ghc8107 = pkgs.hapistrano-ghc8107.flake { }; - flake-ghc902 = pkgs.hapistrano-ghc902.flake { }; - overrideTestPackage = flake: flake.packages."hapistrano:test:test".overrideAttrs (_: { - postFixup = '' - wrapProgram $out/bin/test \ - --set PATH ${pkgs.lib.makeBinPath [ - pkgs.bash - pkgs.coreutils - pkgs.findutils - pkgs.git - pkgs.zsh - ]} - ''; - }); + flake = pkgs.hapistrano.flake { }; in - rec { + flake // rec { apps = { - test-ghc8107 = { + test = { type = "app"; - program = "${packages.test-ghc8107}/bin/test"; - }; - test-ghc902 = { - type = "app"; - program = "${packages.test-ghc902}/bin/test"; + program = "${packages.test}/bin/test"; }; }; - devShells = { - default = devShells.ghc902; - ghc8107 = flake-ghc8107.devShells.default; - ghc902 = flake-ghc902.devShells.default; - }; + legacyPackages = pkgs; packages = { - default = packages.hap-ghc902; - hap-ghc8107 = flake-ghc8107.packages."hapistrano:exe:hap"; - hap-ghc902 = flake-ghc902.packages."hapistrano:exe:hap"; - test-ghc8107 = overrideTestPackage flake-ghc8107; - test-ghc902 = overrideTestPackage flake-ghc902; + default = flake.packages."hapistrano:exe:hap"; + test = flake.packages."hapistrano:test:test".overrideAttrs (_: { + postFixup = '' + wrapProgram $out/bin/test \ + --set PATH ${pkgs.lib.makeBinPath [ + pkgs.bash + pkgs.coreutils + pkgs.findutils + pkgs.git + pkgs.zsh + ]} + ''; + }); }; }); }