File tree 10 files changed +84
-17
lines changed 10 files changed +84
-17
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
use nix
3
+
4
+ # Watch for changes in the following files
3
5
watch_file nixkell.toml
4
6
watch_file package.yaml
5
7
watch_file nix/*
6
8
9
+ # Link the shell path (set in shell.nix) into .direnv
10
+ mkdir -p " $( direnv_layout_dir) "
11
+ rm -f " $( direnv_layout_dir) /shell"
12
+ ln -s " $DEVSHELL_PATH " " $( direnv_layout_dir) /shell"
13
+
14
+ if [[ -f .envrc.private ]]; then
15
+ source .envrc.private
16
+ fi
Original file line number Diff line number Diff line change 62
62
if : ${{ runner.os == 'Linux' }}
63
63
uses : jlumbroso/free-disk-space@main
64
64
65
- - name : Set nix path
65
+ - name : Set nixpkgs url
66
66
id : nix-path
67
67
run : |
68
68
echo "nixpkgs=$(jq -r .nixpkgs.url ./nix/sources.json)" | tee -a $GITHUB_OUTPUT
74
74
extra_nix_config : |
75
75
log-lines = 1000
76
76
77
- - name : Install and configure Cachix
77
+ - name : Install and authorise Cachix
78
78
uses : cachix/cachix-action@v15
79
79
with :
80
80
name : nixkell
@@ -84,10 +84,10 @@ jobs:
84
84
run : |
85
85
nix-shell --run "echo OK"
86
86
87
- - name : Check code formatting (Linux only)
87
+ - name : Treefmt (Linux only)
88
88
if : ${{ runner.os == 'Linux' }}
89
89
run : |
90
- nix-shell --run "treefmt --fail- on-change "
90
+ nix-shell --run "treefmt --ci -- on-unmatched=debug --config-file treefmt-ci.toml --tree-root . "
91
91
92
92
- name : GHC version
93
93
run : |
Original file line number Diff line number Diff line change
1
+ .direnv
1
2
.ghc.environment *
2
3
.hie
3
4
cabal.project.local
Original file line number Diff line number Diff line change 1
1
{
2
+ "haskell.serverExecutablePath" : " haskell-language-server" ,
2
3
"nix.serverPath" : " nil" ,
3
4
"nix.serverSettings" : {
4
5
"nil" : {
Original file line number Diff line number Diff line change 39
39
"--ghc-option=-fwhole-archive-hs-libs" ) ;
40
40
in lib . pipe pkg confFns ;
41
41
42
- hlsDisablePlugins = pkgs . lib . foldr ( plugin : hls :
43
- hlib . disableCabalFlag
44
- ( hls . override { ${ "hls-" + plugin + "-plugin" } = null ; } ) plugin ) ;
42
+ # pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml
43
+ unbreak = drv :
44
+ drv . overrideAttrs ( prev : {
45
+ meta = prev . meta // { broken = false ; } ;
46
+ } ) ;
47
+
48
+ # By default they live in ./haskellPackages/patches
49
+ patch = drv : patches :
50
+ drv . overrideAttrs ( prev : {
51
+ patches = ( prev . patches or [ ] ) ++ patches ;
52
+ } ) ;
53
+
54
+ hlsDisablePlugins =
55
+ pkgs . lib . foldr
56
+ ( plugin : hls : hlib . disableCabalFlag
57
+ ( hls . override ( _ : { ${ plugin } = null ; } ) )
58
+ plugin ) ;
45
59
46
60
# Create your own setup using the choosen GHC version (in the config) as a starting point
47
61
ourHaskell = let
48
62
# https://github.com/pwm/nixkell#direct-hackagegithub-dependencies
49
63
depsFromDir = hlib . packagesFromDirectory { directory = ./packages ; } ;
50
64
51
65
manual = hfinal : hprev : {
52
- cabal-install = util . patch hprev . cabal-install
66
+ cabal-install = patch hprev . cabal-install
53
67
[ ./patches/prevent_missing_index_error.patch ] ;
54
68
55
69
haskell-language-server = hlsDisablePlugins hprev . haskell-language-server
Original file line number Diff line number Diff line change 44
44
gitIgnore path type && ! builtins . elem ( baseNameOf path ) files
45
45
&& ! lib . any ( d : lib . hasPrefix d ( relToPath path ) ) paths ;
46
46
} ;
47
-
48
- patch = name : patches :
49
- name . overrideAttrs ( prev : { patches = prev . patches or [ ] ++ patches ; } ) ;
50
47
}
Original file line number Diff line number Diff line change @@ -17,14 +17,14 @@ haskell_tools = [
17
17
" cabal-install" ,
18
18
" haskell-language-server" ,
19
19
" hlint" ,
20
- " nixfmt" ,
21
20
" ormolu" ,
22
21
]
23
22
24
23
tools = [
25
24
" cabal2nix" ,
26
25
" nil" ,
27
26
" niv" ,
27
+ " nixpkgs-fmt" ,
28
28
" shellcheck" ,
29
29
" shfmt" ,
30
30
" treefmt" ,
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ let pkgs = import ./nix { inherit system compiler; };
3
3
in pkgs . mkShell {
4
4
buildInputs = [ pkgs . nixkell . shell ] ;
5
5
shellHook = ''
6
- export LD_LIBRARY_PATH=${ pkgs . nixkell . shell } /lib:$LD_LIBRARY_PATH
6
+ export DEVSHELL_PATH="${ pkgs . nixkell . shell } "
7
+ export LD_LIBRARY_PATH="${ pkgs . nixkell . shell } /lib$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}"
7
8
logo
8
9
'' ;
9
10
}
Original file line number Diff line number Diff line change
1
+ # One CLI to format the code tree - https://github.com/numtide/treefmt
2
+
3
+ [formatter .haskell ]
4
+ command = " ormolu"
5
+ includes = [" *.hs" ]
6
+ options = [
7
+ " --mode" , " check" ,
8
+ " --check-idempotence" ,
9
+ ]
10
+
11
+ [formatter .nix ]
12
+ command = " nixpkgs-fmt"
13
+ includes = [" *.nix" ]
14
+ excludes = [
15
+ " nix/packages/*.nix" ,
16
+ " nix/sources.nix" ,
17
+ ]
18
+ options = [
19
+ " --check" ,
20
+ ]
21
+
22
+ [formatter .shell ]
23
+ command = " shfmt"
24
+ includes = [" *.sh" ]
25
+ options = [
26
+ " --indent" , " 2" ,
27
+ " --simplify" ,
28
+ " --diff" ,
29
+ ]
30
+
31
+ [formatter .prettier ]
32
+ command = " prettier"
33
+ includes = [
34
+ " *.json" ,
35
+ " *.md" ,
36
+ " *.yaml" ,
37
+ ]
38
+ options = [
39
+ " --list-different"
40
+ ]
41
+ excludes = [
42
+ " nix/sources.json" ,
43
+ ]
Original file line number Diff line number Diff line change 2
2
3
3
[formatter .haskell ]
4
4
command = " ormolu"
5
+ includes = [" *.hs" ]
5
6
options = [
6
7
" --mode" , " inplace" ,
7
- " --check-idempotence"
8
+ " --check-idempotence" ,
8
9
]
9
- includes = [" *.hs" ]
10
10
11
11
[formatter .nix ]
12
- command = " nixfmt "
12
+ command = " nixpkgs-fmt "
13
13
includes = [" *.nix" ]
14
14
excludes = [
15
15
" nix/packages/*.nix" ,
@@ -18,9 +18,9 @@ excludes = [
18
18
19
19
[formatter .shell ]
20
20
command = " shfmt"
21
+ includes = [" *.sh" ]
21
22
options = [
22
23
" --indent" , " 2" ,
23
24
" --simplify" ,
24
25
" --write" ,
25
26
]
26
- includes = [" *.sh" ]
You can’t perform that action at this time.
0 commit comments