diff --git a/.envrc b/.envrc index 3550a30f..30da14fd 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,5 @@ -use flake +export DIRENV_WARN_TIMEOUT=20s + +eval "$(devenv direnvrc)" + +use devenv diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7db85f0..90d3a5a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,31 +9,76 @@ on: types: - opened - synchronize + concurrency: group: build-${{ github.ref }} cancel-in-progress: true jobs: - haskell: + build: + strategy: + matrix: + runner: + - macos-latest + - ubuntu-latest + runs-on: ${{ matrix.runner }} + env: + LANG: en_US.UTF-8 + LC_ALL: en_US.UTF-8 + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v31 + - name: Setup Cachix + uses: cachix/cachix-action@v16 + with: + name: devenv + - name: Install devenv + run: nix profile install nixpkgs#devenv + - name: Setup cache for `~/.stack` + uses: actions/cache@v4 + with: + path: ~/.stack + key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }} + restore-keys: | + ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}- + ${{ runner.os }}-stack-global- + - name: Install dependencies + run: devenv shell -- stack build --only-dependencies --test + - name: Setup cache for `.stack-work` + uses: actions/cache@v4 + with: + path: .stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }}-${{ hashFiles('**/*.hs') }} + restore-keys: | + ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('hapistrano.cabal') }}- + ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}- + ${{ runner.os }}-stack-work- + - name: Compile code + run: devenv shell -- stack build --test --no-run-tests + - name: Run tests + run: devenv shell -- stack test + + nix-build: strategy: matrix: - os: - - macos-13 # x86_64-darwin - - macos-latest # aarch64-darwin - - ubuntu-latest # x86_64-linux - fail-fast: true - runs-on: ${{ matrix.os }} - timeout-minutes: 30 + runner: + - macos-latest + - ubuntu-latest + runs-on: ${{ matrix.runner }} steps: - - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v12 + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v31 + - name: Setup Cachix + uses: cachix/cachix-action@v16 with: - extra-conf: accept-flake-config = true - - uses: DeterminateSystems/magic-nix-cache-action@v7 - - name: Compile code ${{ matrix.ghc }} - run: nix build .#test - - name: Run tests ${{ matrix.ghc }} - run: nix run .#test + name: stackbuilders + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + - name: Build `default` package + run: nix build docker: uses: ./.github/workflows/reusable-docker.yml diff --git a/.gitignore b/.gitignore index b1e6960f..542f8599 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ cabal.sandbox.config .stack-work/ dist-newstyle result -nix/ .ghc.environment.* .tmuxinator.yml # Devenv diff --git a/bin/ghc810 b/bin/ghc810 deleted file mode 100755 index 53018177..00000000 --- a/bin/ghc810 +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -nix develop .#ghc810 --accept-flake-config "$@" diff --git a/bin/ghc90 b/bin/ghc90 deleted file mode 100755 index 4545407b..00000000 --- a/bin/ghc90 +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -nix develop .#ghc90 --accept-flake-config "$@" diff --git a/devenv.lock b/devenv.lock index 7e7c5c50..083f5fb4 100644 --- a/devenv.lock +++ b/devenv.lock @@ -20,11 +20,10 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, + "lastModified": 1733328505, "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -33,10 +32,31 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742649964, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ - "pre-commit-hooks", + "git-hooks", "nixpkgs" ] }, @@ -45,7 +65,6 @@ "owner": "hercules-ci", "repo": "gitignore.nix", "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9", "type": "github" }, "original": { @@ -70,50 +89,14 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1718811006, - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "03d771e513ce90147b65fe922d87d3a0356fc125", - "treeHash": "ab837eb82b2b0afbb6568f2b27f214324699af3d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1718879355, - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "8cd35b9496d21a6c55164d8547d9d5280162b07a", - "treeHash": "246f2197feb48979ccc58af4cab0cfd0f5738645", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "devenv": "devenv", + "git-hooks": "git-hooks", "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" + "pre-commit-hooks": [ + "git-hooks" + ] } } }, diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 00000000..6797bd8a --- /dev/null +++ b/devenv.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, ... }: + +{ + packages = + [ + pkgs.git + pkgs.stack + pkgs.zsh + ] + ++ lib.optionals pkgs.stdenv.isLinux [ + pkgs.gmp + ]; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 00000000..68616a49 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,4 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling diff --git a/docs/NIX.md b/docs/NIX.md index d0c85bf0..3b1b9c20 100644 --- a/docs/NIX.md +++ b/docs/NIX.md @@ -3,46 +3,50 @@ ## Requirements - Install [Nix](https://nixos.org/download.html) -- Enable Flakes [permanently](https://nixos.wiki/wiki/Flakes#Permanent) +- Enable [Flakes](https://nixos.wiki/wiki/Flakes#Permanent) permanently +- Install [devenv](https://devenv.sh/getting-started/): -**For macOS users** +## Project Structure -Add the following lines to configuration file located at `/etc/nix/nix.conf`: +The project uses: +- Nix Flakes for reproducible builds and development environments +- `stacklock2nix` for deriving Nix packages from stack.yaml.lock +- `devenv` for creating consistent development environments -``` -trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= -substituters = https://cache.iog.io https://cache.nixos.org -``` +### Flake.nix -Restart the `nix-daemon` service: +The flake.nix file has the following inputs: +- `nixpkgs`: Standard Nix packages repository +- `stacklock2nix`: A tool for generating Nix packages from stack.yaml.lock files -``` -sudo launchctl stop org.nixos.nix-daemon -sudo launchctl start org.nixos.nix-daemon -``` +The flake outputs: +- `packages.default`: The Hapistrano package for each supported system +- `overlays.default`: An overlay for integrating Hapistrano into other Nix + systems -If the following messages appear running the scripts detailed in the section -below, it means that Nix is not picking up the substituters we described -earlier and is unable to use them as a derivation cache: +## Development Environments -``` -warning: ignoring untrusted substituter 'https://cache.iog.io' -``` -in which case -it is recommended to go over the steps detailed in this section again, or look for alternative ways to add extra substituters in [nix.conf](https://nix.dev/manual/nix/2.18/command-ref/conf-file). - -## Enabling the development environment +The project includes a `devenv.nix` configuration that provides a consistent +development environment with all necessary dependencies. -To enable the development environment exposed by the project's [Nix flake](../flake.nix), you can start a development shell by running the following command from within the project's root: +To use devenv: ``` -nix develop +devenv shell ``` -Alternatively, if you are using [nix-direnv](https://github.com/nix-community/nix-direnv) (recommended), you can run: +The devenv configuration includes: +- Essential tools like git, stack, and zsh +- System-specific dependencies (e.g., gmp for Linux systems) + +### Using nix-direnv + +If you are using [nix-direnv](https://github.com/nix-community/nix-direnv), run: ``` direnv allow ``` -that will enable the development shell according to the contents of [.envrc](../.envrc). It is advisable not to run `direnv allow` blindly and always check the contents of [.envrc](../.envrc) files first to ensure nothing malicious is executed. +This will enable the development shell according to the contents of +[.envrc](../.envrc). Always check the contents of [.envrc](../.envrc) files +before running `direnv allow` to ensure nothing malicious is executed. diff --git a/flake.lock b/flake.lock index 7f51fc82..cbb03d7e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,703 +1,38 @@ { "nodes": { - "HTTP": { - "flake": false, - "locked": { - "lastModified": 1451647621, - "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", - "owner": "phadej", - "repo": "HTTP", - "rev": "9bc0996d412fef1787449d841277ef663ad9a915", - "type": "github" - }, - "original": { - "owner": "phadej", - "repo": "HTTP", - "type": "github" - } - }, - "cabal-32": { - "flake": false, - "locked": { - "lastModified": 1603716527, - "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=", - "owner": "haskell", - "repo": "cabal", - "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.2", - "repo": "cabal", - "type": "github" - } - }, - "cabal-34": { - "flake": false, - "locked": { - "lastModified": 1645834128, - "narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=", - "owner": "haskell", - "repo": "cabal", - "rev": "5ff598c67f53f7c4f48e31d722ba37172230c462", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.4", - "repo": "cabal", - "type": "github" - } - }, - "cabal-36": { - "flake": false, - "locked": { - "lastModified": 1669081697, - "narHash": "sha256-I5or+V7LZvMxfbYgZATU4awzkicBwwok4mVoje+sGmU=", - "owner": "haskell", - "repo": "cabal", - "rev": "8fd619e33d34924a94e691c5fea2c42f0fc7f144", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "3.6", - "repo": "cabal", - "type": "github" - } - }, - "cardano-shell": { - "flake": false, - "locked": { - "lastModified": 1608537748, - "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=", - "owner": "input-output-hk", - "repo": "cardano-shell", - "rev": "9392c75087cb9a3d453998f4230930dea3a95725", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "cardano-shell", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1672831974, - "narHash": "sha256-z9k3MfslLjWQfnjBtEtJZdq3H7kyi2kQtUThfTgdRk0=", - "owner": "input-output-hk", - "repo": "flake-compat", - "rev": "45f2638735f8cdc40fe302742b79f248d23eb368", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "ref": "hkm/gitlab-fix", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "ghc-8.6.5-iohk": { - "flake": false, - "locked": { - "lastModified": 1600920045, - "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", - "owner": "input-output-hk", - "repo": "ghc", - "rev": "95713a6ecce4551240da7c96b6176f980af75cae", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "ref": "release/8.6.5-iohk", - "repo": "ghc", - "type": "github" - } - }, - "hackage": { - "flake": false, - "locked": { - "lastModified": 1727656118, - "narHash": "sha256-RwerqkdfQIP2IsVbRmuYbb+eogm6S9Bk1CO49shkGVs=", - "owner": "input-output-hk", - "repo": "hackage.nix", - "rev": "b9ffc606875b2ccf24a08a1dc84419a6a9eb5d9b", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "hackage.nix", - "type": "github" - } - }, - "haskellNix": { - "inputs": { - "HTTP": "HTTP", - "cabal-32": "cabal-32", - "cabal-34": "cabal-34", - "cabal-36": "cabal-36", - "cardano-shell": "cardano-shell", - "flake-compat": "flake-compat", - "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", - "hackage": "hackage", - "hls-1.10": "hls-1.10", - "hls-2.0": "hls-2.0", - "hls-2.2": "hls-2.2", - "hls-2.3": "hls-2.3", - "hls-2.4": "hls-2.4", - "hls-2.5": "hls-2.5", - "hls-2.6": "hls-2.6", - "hls-2.7": "hls-2.7", - "hls-2.8": "hls-2.8", - "hls-2.9": "hls-2.9", - "hpc-coveralls": "hpc-coveralls", - "hydra": "hydra", - "iserv-proxy": "iserv-proxy", - "nixpkgs": [ - "haskellNix", - "nixpkgs-unstable" - ], - "nixpkgs-2003": "nixpkgs-2003", - "nixpkgs-2105": "nixpkgs-2105", - "nixpkgs-2111": "nixpkgs-2111", - "nixpkgs-2205": "nixpkgs-2205", - "nixpkgs-2211": "nixpkgs-2211", - "nixpkgs-2305": "nixpkgs-2305", - "nixpkgs-2311": "nixpkgs-2311", - "nixpkgs-2405": "nixpkgs-2405", - "nixpkgs-unstable": "nixpkgs-unstable", - "old-ghc-nix": "old-ghc-nix", - "stackage": "stackage" - }, - "locked": { - "lastModified": 1727657466, - "narHash": "sha256-aOHI5E0PcihXlwQQgcSiLsIrk4sYg4SI+zxpFO34lC8=", - "owner": "input-output-hk", - "repo": "haskell.nix", - "rev": "a4fc7302dec23f5ae2064b90b19090067be1550e", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "haskell.nix", - "type": "github" - } - }, - "hls-1.10": { - "flake": false, - "locked": { - "lastModified": 1680000865, - "narHash": "sha256-rc7iiUAcrHxwRM/s0ErEsSPxOR3u8t7DvFeWlMycWgo=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "b08691db779f7a35ff322b71e72a12f6e3376fd9", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "1.10.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.0": { - "flake": false, - "locked": { - "lastModified": 1687698105, - "narHash": "sha256-OHXlgRzs/kuJH8q7Sxh507H+0Rb8b7VOiPAjcY9sM1k=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "783905f211ac63edf982dd1889c671653327e441", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.0.0.1", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.2": { - "flake": false, - "locked": { - "lastModified": 1693064058, - "narHash": "sha256-8DGIyz5GjuCFmohY6Fa79hHA/p1iIqubfJUTGQElbNk=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "b30f4b6cf5822f3112c35d14a0cba51f3fe23b85", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.2.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.3": { - "flake": false, - "locked": { - "lastModified": 1695910642, - "narHash": "sha256-tR58doOs3DncFehHwCLczJgntyG/zlsSd7DgDgMPOkI=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "458ccdb55c9ea22cd5d13ec3051aaefb295321be", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.3.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.4": { - "flake": false, - "locked": { - "lastModified": 1699862708, - "narHash": "sha256-YHXSkdz53zd0fYGIYOgLt6HrA0eaRJi9mXVqDgmvrjk=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "54507ef7e85fa8e9d0eb9a669832a3287ffccd57", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.4.0.1", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.5": { - "flake": false, - "locked": { - "lastModified": 1701080174, - "narHash": "sha256-fyiR9TaHGJIIR0UmcCb73Xv9TJq3ht2ioxQ2mT7kVdc=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "27f8c3d3892e38edaef5bea3870161815c4d014c", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.5.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.6": { - "flake": false, - "locked": { - "lastModified": 1705325287, - "narHash": "sha256-+P87oLdlPyMw8Mgoul7HMWdEvWP/fNlo8jyNtwME8E8=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "6e0b342fa0327e628610f2711f8c3e4eaaa08b1e", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.6.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.7": { - "flake": false, - "locked": { - "lastModified": 1708965829, - "narHash": "sha256-LfJ+TBcBFq/XKoiNI7pc4VoHg4WmuzsFxYJ3Fu+Jf+M=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "50322b0a4aefb27adc5ec42f5055aaa8f8e38001", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.7.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.8": { - "flake": false, - "locked": { - "lastModified": 1715153580, - "narHash": "sha256-Vi/iUt2pWyUJlo9VrYgTcbRviWE0cFO6rmGi9rmALw0=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "dd1be1beb16700de59e0d6801957290bcf956a0a", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.8.0.0", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hls-2.9": { - "flake": false, - "locked": { - "lastModified": 1720003792, - "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", - "type": "github" - }, - "original": { - "owner": "haskell", - "ref": "2.9.0.1", - "repo": "haskell-language-server", - "type": "github" - } - }, - "hpc-coveralls": { - "flake": false, - "locked": { - "lastModified": 1607498076, - "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", - "owner": "sevanspowell", - "repo": "hpc-coveralls", - "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", - "type": "github" - }, - "original": { - "owner": "sevanspowell", - "repo": "hpc-coveralls", - "type": "github" - } - }, - "hydra": { - "inputs": { - "nix": "nix", - "nixpkgs": [ - "haskellNix", - "hydra", - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1671755331, - "narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=", - "owner": "NixOS", - "repo": "hydra", - "rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8", - "type": "github" - }, - "original": { - "id": "hydra", - "type": "indirect" - } - }, - "iserv-proxy": { - "flake": false, - "locked": { - "lastModified": 1717479972, - "narHash": "sha256-7vE3RQycHI1YT9LHJ1/fUaeln2vIpYm6Mmn8FTpYeVo=", - "owner": "stable-haskell", - "repo": "iserv-proxy", - "rev": "2ed34002247213fc435d0062350b91bab920626e", - "type": "github" - }, - "original": { - "owner": "stable-haskell", - "ref": "iserv-syms", - "repo": "iserv-proxy", - "type": "github" - } - }, - "lowdown-src": { - "flake": false, - "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs", - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1661606874, - "narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=", - "owner": "NixOS", - "repo": "nix", - "rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "2.11.0", - "repo": "nix", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1657693803, - "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.05-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2003": { - "locked": { - "lastModified": 1620055814, - "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-20.03-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2105": { - "locked": { - "lastModified": 1659914493, - "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2111": { - "locked": { - "lastModified": 1659446231, - "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2205": { - "locked": { - "lastModified": 1685573264, - "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "380be19fbd2d9079f677978361792cb25e8a3635", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-22.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2211": { - "locked": { - "lastModified": 1688392541, - "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-22.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2305": { - "locked": { - "lastModified": 1705033721, - "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-23.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2311": { - "locked": { - "lastModified": 1719957072, - "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-23.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2405": { - "locked": { - "lastModified": 1720122915, - "narHash": "sha256-Nby8WWxj0elBu1xuRaUcRjPi/rU3xVbkAt2kj4QwX2U=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "835cf2d3f37989c5db6585a28de967a667a75fb1", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-24.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1720181791, - "narHash": "sha256-i4vJL12/AdyuQuviMMd1Hk2tsGt02hDNhA0Zj1m16N8=", - "owner": "NixOS", + "lastModified": 1742850322, + "narHash": "sha256-iinn8lHhcpWHL7ccJFH/SUIPb4+YdvTUhFkdzHLt7n0=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "4284c2b73c8bce4b46a6adf23e16d9e2ec8da4bb", + "rev": "b7a97f713793d62f2090a703fca9b7a21cdd8314", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", + "owner": "nixos", "repo": "nixpkgs", "type": "github" } }, - "old-ghc-nix": { - "flake": false, - "locked": { - "lastModified": 1631092763, - "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", - "owner": "angerman", - "repo": "old-ghc-nix", - "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", - "type": "github" - }, - "original": { - "owner": "angerman", - "ref": "master", - "repo": "old-ghc-nix", - "type": "github" - } - }, "root": { "inputs": { - "flake-utils": "flake-utils", - "haskellNix": "haskellNix", - "nixpkgs": [ - "haskellNix", - "nixpkgs-unstable" - ] - } - }, - "stackage": { - "flake": false, - "locked": { - "lastModified": 1727655087, - "narHash": "sha256-t+mvlQp15og02vGhehBR5Amv3r+eTMJ7IE3BdpqmPVo=", - "owner": "input-output-hk", - "repo": "stackage.nix", - "rev": "08a17b45866f3de7bbd083677ea28b56c74cd1f3", - "type": "github" - }, - "original": { - "owner": "input-output-hk", - "repo": "stackage.nix", - "type": "github" + "nixpkgs": "nixpkgs", + "stacklock2nix": "stacklock2nix" } }, - "systems": { + "stacklock2nix": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1742355519, + "narHash": "sha256-X5niEE/oc58LORprUdwWo/sHH0Gs776WeTbylfzrxwg=", + "owner": "cdepillabout", + "repo": "stacklock2nix", + "rev": "65fb3f8537b063b9036a8033a905795fa0b1952c", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "cdepillabout", + "repo": "stacklock2nix", "type": "github" } } diff --git a/flake.nix b/flake.nix index a7f3c640..55bcea8b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,68 +1,54 @@ { inputs = { - flake-utils.url = "github:numtide/flake-utils"; - haskellNix.url = "github:input-output-hk/haskell.nix"; - nixpkgs.follows = "haskellNix/nixpkgs-unstable"; + nixpkgs.url = "github:nixos/nixpkgs"; + stacklock2nix.url = "github:cdepillabout/stacklock2nix"; }; - nixConfig = { - allow-import-from-derivation = "true"; - extra-substituters = [ - "https://cache.iog.io" - "https://cache.zw3rk.com" - ]; - extra-trusted-public-keys = [ - "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" - "loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=" - ]; - }; - - outputs = inputs@{ self, flake-utils, haskellNix, nixpkgs }: - # https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes.html - flake-utils.lib.eachDefaultSystem (system: - let - overlays = [ - haskellNix.overlay - (final: prev: { - hapistrano = final.haskell-nix.cabalProject' { - src = final.haskell-nix.haskellLib.cleanGit { - name = "hapistrano"; - src = ./.; - }; - # This is used by `nix develop .` to open a shell for use with - # `cabal`, `hlint` and `haskell-language-server` - shell.tools = { - cabal = {}; - hlint = {}; - haskell-language-server = {}; - }; - compiler-nix-name = "ghc966"; - }; - }) - ]; - pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; - flake = pkgs.hapistrano.flake { }; - in rec { - apps = { - test = { - type = "app"; - program = "${packages.test}/bin/test"; - }; - }; - packages = { - 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 - ]} - ''; - }); - }; - }); + outputs = + { + self, + nixpkgs, + stacklock2nix, + ... + }: + let + supportedSystems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + unstestedSystems = [ + "aarch64-linux" + "x86_64-darwin" + ]; + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); + nixpkgsFor = forAllSystems ( + system: + import nixpkgs { + inherit system; + overlays = [ + stacklock2nix.overlay + (import ./nix/overlay.nix) + ]; + } + ); + in + { + packages = forAllSystems ( + system: + let + pkgs = nixpkgsFor.${system}; + in + { + default = + pkgs.lib.warnIf (builtins.any (x: x == system) unstestedSystems) + "'${system}' is not tested as part of the CI workflow; please report any issues you encounter while dealing with it." + pkgs.hapistrano; + } + ); + overlays.default = final: prev: { + hapistrano = self.packages.${prev.system}.default; + }; + }; } diff --git a/hapistrano.cabal b/hapistrano.cabal index 8b49ce37..1af276b5 100644 --- a/hapistrano.cabal +++ b/hapistrano.cabal @@ -1,6 +1,6 @@ cabal-version: 1.18 name: hapistrano -version: 0.4.9.0 +version: 0.4.10.0 synopsis: A deployment library for Haskell applications description: . @@ -28,7 +28,7 @@ category: System homepage: https://github.com/stackbuilders/hapistrano bug-reports: https://github.com/stackbuilders/hapistrano/issues build-type: Simple -tested-with: GHC==9.6.6 +tested-with: GHC==9.8.4 extra-doc-files: CHANGELOG.md , README.md @@ -52,13 +52,13 @@ library , System.Hapistrano.Commands.Internal , System.Hapistrano.Maintenance build-depends: aeson >= 2.0 && < 3.0 - , ansi-terminal >= 0.9 && < 0.12 + , ansi-terminal >= 0.9 && < 2.0 , base >= 4.9 && < 5.0 , directory >= 1.2.5 && < 1.4 , filepath >= 1.2 && < 1.5 , gitrev >= 1.2 && < 1.4 , mtl >= 2.0 && < 3.0 - , megaparsec >= 9.0.0 && < 9.6.1 + , megaparsec >= 9.0 && < 10.0 , stm >= 2.0 && < 2.6 , path >= 0.5 && < 1.0 , path-io >= 1.2 && < 1.9 @@ -84,7 +84,7 @@ executable hap , formatting >= 6.2 && < 8.0 , gitrev >= 1.2 && < 1.4 , hapistrano - , optparse-applicative >= 0.11 && < 0.17 + , optparse-applicative >= 0.11 && < 0.19 , stm >= 2.4 && < 2.6 , yaml >= 0.11.7 && < 0.12 if flag(dev) diff --git a/nix/overlay.nix b/nix/overlay.nix new file mode 100644 index 00000000..f45459bf --- /dev/null +++ b/nix/overlay.nix @@ -0,0 +1,27 @@ +final: prev: { + hapistrano-stacklock = final.stacklock2nix { + stackYaml = ../stack.yaml; + # The version of the compiler declared here must match the GHC version + # provided by the stack resolver. + baseHaskellPkgSet = final.haskell.packages.ghc984; + all-cabal-hashes = final.fetchFromGitHub { + owner = "commercialhaskell"; + repo = "all-cabal-hashes"; + rev = "299918adb3205b2dfe960bcdc79a9b1b300b11e6"; + sha256 = + if final.stdenv.isLinux then + "sha256-9nkHnZusYNDntpH9LrLTamY9BimRWfeX2m99lAuMCMI=" + else + "sha256-Z0UJ78I3O8kWduNOqz7jASnR5XB8mwBDP0fVvjJoqOg="; + }; + additionalHaskellPkgSetOverrides = hfinal: hprev: { + hapistrano = final.haskell.lib.compose.overrideCabal (drv: { + testToolDepends = drv.testToolDepends ++ [ + final.git + final.zsh + ]; + }) hprev.hapistrano; + }; + }; + hapistrano = final.hapistrano-stacklock.pkgSet.hapistrano; +} diff --git a/stack.yaml b/stack.yaml index ffc3795e..a97be0f1 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-17.10 -packages: - - . -allow-newer: true +# After upgrading the resolver, make sure that the GHC version specified in the +# `./nix/overlay.nix` file under the `baseHaskellPkgSet` field matches the +# compiler version provided by the resolver. +resolver: lts-23.15 diff --git a/stack.yaml.lock b/stack.yaml.lock index 8d057378..dc2195be 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -6,7 +6,7 @@ packages: [] snapshots: - completed: - size: 567241 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/17/10.yaml - sha256: 321b3b9f0c7f76994b39e0dabafdc76478274b4ff74cc5e43d410897a335ad3b - original: lts-17.10 + sha256: 3020db98a5e35009543057d6e6b96890d285890fc97688933e1798da92c8bbde + size: 683815 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/15.yaml + original: lts-23.15