Skip to content

Commit

Permalink
Reduce Nix support
Browse files Browse the repository at this point in the history
This removes the support for:
- Dev shells with pre-built packages
- Building binaries

These have been almost continually broken, and nobody is really
maintaining them. Better to just do the simple thing we can do reliably,
which is to provide dev shells.

Closes #3800
  • Loading branch information
michaelpj committed Nov 13, 2023
1 parent 0f9be3e commit de85bf4
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 783 deletions.
61 changes: 2 additions & 59 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
should_skip_develop: ${{ steps.skip_check.outputs.should_skip }}
should_skip_build: ${{ steps.skip_check_no_nix.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
Expand All @@ -35,11 +34,6 @@ jobs:
, ".gitlab-ci.yaml"
, ".gitlab/**"
]'
- id: skip_check_no_nix
uses: fkirc/[email protected]
with:
cancel_others: false
paths: '[ "**.nix" ]'

# Enter the development shell and run `cabal build`
develop:
Expand All @@ -63,66 +57,15 @@ jobs:
- uses: cachix/cachix-action@v12
with:
name: haskell-language-server
# Disable pushing, we will do that in job `build`
skipPush: true
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
- run: |
nix develop --print-build-logs --command cabal update
nix develop --print-build-logs --command cabal build
# Build and then push HLS binaries with developmet shell to cachix
# This job runs when
# 1. PRs are merged to master (runs on master)
# 2. Nix files are changed (runs on PR)
build:
needs: pre_job
runs-on: ${{ matrix.os }}
env:
HAS_TOKEN: ${{ secrets.HLS_CACHIX_AUTH_TOKEN != '' }}
if: (needs.pre_job.outputs.should_skip_build != 'true' && needs.pre_job.outputs.should_skip_pr != 'true') || (github.repository_owner == 'haskell' && github.ref == 'refs/heads/master')
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]

steps:
- uses: actions/checkout@v3

- uses: cachix/install-nix-action@v23
with:
extra_nix_config: |
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: haskell-language-server
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
- name: Build development shell
run: nix develop --print-build-logs --profile dev
- name: Build all development shell (without nix dependencies)
run: nix develop --print-build-logs .#all-simple-dev-shells --profile dev
# We only build nix dev shell for current GHC version because some are
# failing with different GHC version on darwin.
- name: Build development shell with nix dependencies for current GHC version
if: matrix.os == 'macOS-latest'
run: nix develop --print-build-logs .#haskell-language-server-dev-nix --profile dev
- name: Build development shells with nix dependencies
if: matrix.os == 'ubuntu-latest'
run: nix develop --print-build-logs .#all-nix-dev-shells --profile dev
- name: Push development shell
if: ${{ env.HAS_TOKEN == 'true' }}
run: cachix push haskell-language-server dev
- name: Build binaries
run: nix build --print-build-logs
- name: Build all binaries
run: nix build --print-build-logs .#all-haskell-language-server
- name: Push binaries
if: ${{ env.HAS_TOKEN == 'true' }}
run: nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server

nix_post_job:
if: always()
runs-on: ubuntu-latest
needs: [pre_job, develop, build]
needs: [pre_job, develop]
steps:
- run: |
echo "jobs info: ${{ toJSON(needs) }}"
Expand Down
53 changes: 0 additions & 53 deletions configuration-ghc-90.nix

This file was deleted.

53 changes: 0 additions & 53 deletions configuration-ghc-92.nix

This file was deleted.

36 changes: 0 additions & 36 deletions configuration-ghc-94.nix

This file was deleted.

61 changes: 0 additions & 61 deletions configuration-ghc-96.nix

This file was deleted.

9 changes: 2 additions & 7 deletions docs/contributing/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,11 @@ $ cabal build
If you are using nix 2.4 style command (enabled by `experimental-features = nix-command`),
you can use `nix develop` instead of `nix-shell` to enter the development shell. To enter the shell with specific GHC versions:

* `nix develop` or `nix develop .#haskell-language-server-dev` - default GHC version
* `nix develop .#haskell-language-server-901-dev` - GHC 9.0.1 (substitute GHC version as appropriate)
* `nix develop` - default GHC version
* `nix develop .#shell-ghc90` - GHC 9.0.1 (substitute GHC version as appropriate)

If you are looking for a Nix expression to create haskell-language-server binaries, see https://github.com/haskell/haskell-language-server/issues/122

To create binaries:

* `nix build` or `nix build .#haskell-language-server` - default GHC version
* `nix build .#haskell-language-server-901` - GHC 9.0.1 (substitute GHC version as appropriate)

## Testing

The tests make use of the [Tasty](https://github.com/feuerbach/tasty) test framework.
Expand Down
Loading

0 comments on commit de85bf4

Please sign in to comment.