Skip to content

Commit 959da62

Browse files
authored
Fix nix build for haskell#1858 (haskell#1870)
* Fix nix build for haskell#1858 * Update skip paths * Run job nix build on PRs that change nix files * Fix typo
1 parent 204fdcb commit 959da62

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

.github/workflows/bench.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: fkirc/[email protected]
1616
with:
1717
cancel_others: true
18-
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "nix/**", "**/test/**"]'
18+
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "**.nix", "**/test/**", "flake.lock"]'
1919

2020
bench-init:
2121
needs: pre_job

.github/workflows/nix.yml

+27-12
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ jobs:
1212
pre_job:
1313
runs-on: ubuntu-latest
1414
outputs:
15-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
15+
should_skip_develop: ${{ steps.skip_check.outputs.should_skip }}
16+
should_skip_build: ${{ steps.skip_check_no_nix.outputs.should_skip }}
1617
steps:
1718
- id: skip_check
1819
uses: fkirc/skip-duplicate-actions@master
1920
with:
2021
cancel_others: true
2122
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**"]'
23+
- id: skip_check_no_nix
24+
uses: fkirc/skip-duplicate-actions@master
25+
with:
26+
cancel_others: false
27+
paths: '["**.nix"]'
2228

2329
# Enter the development shell and run `cabal build`
2430
develop:
@@ -31,34 +37,39 @@ jobs:
3137
os: [ubuntu-latest, macOS-latest]
3238

3339
steps:
34-
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
40+
- if: ${{ needs.pre_job.outputs.should_skip_develop != 'true' }}
3541
uses: actions/checkout@v2
3642
with:
3743
submodules: true
38-
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
44+
- if: ${{ needs.pre_job.outputs.should_skip_develop != 'true' }}
3945
uses: cachix/install-nix-action@v13
4046
with:
4147
install_url: https://nixos-nix-install-tests.cachix.org/serve/lb41az54kzk6j12p81br4bczary7m145/install
4248
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
4349
extra_nix_config: |
4450
experimental-features = nix-command flakes
4551
nix_path: nixpkgs=channel:nixos-unstable
46-
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
52+
- if: ${{ needs.pre_job.outputs.should_skip_develop != 'true' }}
4753
uses: cachix/cachix-action@v10
4854
with:
4955
name: haskell-language-server
5056
# Disable pushing, we will do that in job `build`
5157
skipPush: true
52-
- if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
58+
- if: ${{ needs.pre_job.outputs.should_skip_develop != 'true' }}
5359
run: |
5460
nix develop --command cabal update
5561
nix develop --command cabal build
5662
5763
# Build and then push HLS binaries with developmet shell to cachix
58-
# This job runs when PRs are merged to master, and should be excluded from branch protections
64+
# This job runs when
65+
# 1. PRs are merged to master (runs on master)
66+
# 2. Nix files are changed (runs on PR)
5967
build:
68+
needs: pre_job
6069
runs-on: ${{ matrix.os }}
61-
if: ${{ github.repository_owner == 'haskell' && github.ref == 'refs/heads/master' }}
70+
env:
71+
HAS_TOKEN: ${{ secrets.HLS_CACHIX_AUTH_TOKEN != '' }}
72+
if: ${{ needs.pre_job.outputs.should_skip_build != 'true' || (github.repository_owner == 'haskell' && github.ref == 'refs/heads/master') }}
6273
strategy:
6374
fail-fast: false
6475
matrix:
@@ -79,9 +90,13 @@ jobs:
7990
with:
8091
name: haskell-language-server
8192
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
93+
- name: Build development shell
94+
run: nix develop --profile dev
8295
- name: Push development shell
83-
run: nix develop --profile dev && cachix push haskell-language-server dev
84-
- name: Build and push binaries
85-
run: |
86-
nix build
87-
nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server
96+
if: ${{ env.HAS_TOKEN == 'true' }}
97+
run: cachix push haskell-language-server dev
98+
- name: Build binaries
99+
run: nix build
100+
- name: Push binaries
101+
if: ${{ env.HAS_TOKEN == 'true' }}
102+
run: nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: fkirc/[email protected]
2121
with:
2222
cancel_others: true
23-
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "nix/**"]'
23+
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "**.nix", "flake.lock"]'
2424
# If we only change ghcide downstream packages we have not test ghcide itself
2525
- id: skip_ghcide_check
2626
uses: fkirc/[email protected]

flake.nix

+18-2
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,29 @@
6969
} // pluginSourceDirs;
7070

7171
# Tweak our packages
72+
# Don't use `callHackage`, it requires us to override `all-cabal-hashes`
7273
tweaks = hself: hsuper:
7374
with haskell.lib; {
74-
hls-hlint-plugin =
75-
hsuper.hls-hlint-plugin.override { hlint = hself.hlint_3_2_7; };
75+
76+
# https://github.com/haskell/haskell-language-server/pull/1858
77+
# Remove this override when nixpkgs has this package
78+
apply-refact_0_9_3_0 = hself.callCabal2nix "apply-refact"
79+
(builtins.fetchTarball {
80+
url =
81+
"https://hackage.haskell.org/package/apply-refact-0.9.3.0/apply-refact-0.9.3.0.tar.gz";
82+
sha256 =
83+
"1jfq1aw91finlpq5nn7a96za4c8j13jk6jmx2867fildxwrik2qj";
84+
}) { };
85+
86+
hls-hlint-plugin = hsuper.hls-hlint-plugin.override {
87+
hlint = hself.hlint_3_2_7;
88+
apply-refact = hself.apply-refact_0_9_3_0;
89+
};
90+
7691
hls-tactics-plugin = hsuper.hls-tactics-plugin.override {
7792
refinery = hself.refinery_0_3_0_0;
7893
};
94+
7995
};
8096

8197
hlsSources =

0 commit comments

Comments
 (0)