Add a flake check for HLS (#47)

Also use check-flake for .#check package.

Deal with network access by disabling sandbox, and excluding in garnix.
This commit is contained in:
Sridhar Ratnakumar 2022-08-28 18:50:08 -04:00 committed by GitHub
parent b003dbdd1a
commit 5cfb230f15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 13 deletions

View file

@ -18,13 +18,16 @@ jobs:
- name: Cache Nix dependencies
run: |
nix develop -j 4 -c echo
- name: Format check
- name: Flake checks
run: |
nix develop -j auto -c treefmt --fail-on-change
# Sandbox must be disabled due to HLS,
# https://github.com/haskell/haskell-language-server/issues/3128
nix --option sandbox false build .#check --no-link -L
# TODO: Remove after https://github.com/srid/haskell-flake/issues/19
- name: Hlint
run: |
nix develop -j auto -c hlint src
- name: Build
id: build
run: |
nix build -j auto
nix build -j auto -L

View file

@ -47,6 +47,7 @@ git add . && git commit -m rename
## Tips
- Run `nix flake update` to update all flake inputs.
- Run `nix --option sandbox false build .#check -L` to run the flake checks.
- Run `treefmt` in nix shell to autoformat the project. This uses [treefmt](https://github.com/numtide/treefmt), which uses `./treefmt.toml` (where fourmolu and nixpkgs-fmt are specified).
- Run `bin/hoogle` to start Hoogle with packages in your cabal file.
- Run `bin/test` to run the test suite.

22
flake.lock generated
View file

@ -1,5 +1,20 @@
{
"nodes": {
"check-flake": {
"locked": {
"lastModified": 1661723725,
"narHash": "sha256-zbt1vEDQ5Uxdqz4AlW/xOvoUs9tK4ayg8q4+2EtrMEQ=",
"owner": "srid",
"repo": "check-flake",
"rev": "e48e6b5c86f6fb67f0e565a6862fa8b3e7a53446",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "check-flake",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs": [
@ -22,11 +37,11 @@
},
"haskell-flake": {
"locked": {
"lastModified": 1660319056,
"narHash": "sha256-MX6PLEtXVyXXUEk3t1e0c20XRL4m4u9TFET2X0TpTdE=",
"lastModified": 1661726764,
"narHash": "sha256-YzzOoff6m3W4g4B0E8xd3omvOhEVuRu/Rdvnmy2H6Jc=",
"owner": "srid",
"repo": "haskell-flake",
"rev": "1ca2be3c354ef2a3296cac7e54ae21e1d6ead6d7",
"rev": "3c27b5ba2eafc52f4bed232a8ff74cf0a5a99375",
"type": "github"
},
"original": {
@ -53,6 +68,7 @@
},
"root": {
"inputs": {
"check-flake": "check-flake",
"flake-parts": "flake-parts",
"haskell-flake": "haskell-flake",
"nixpkgs": "nixpkgs",

View file

@ -6,14 +6,16 @@
flake-parts.inputs.nixpkgs.follows = "nixpkgs";
haskell-flake.url = "github:srid/haskell-flake";
treefmt-flake.url = "github:srid/treefmt-flake";
check-flake.url = "github:srid/check-flake";
};
outputs = { self, nixpkgs, flake-parts, haskell-flake, treefmt-flake, ... }:
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit self; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [
haskell-flake.flakeModule
treefmt-flake.flakeModule
inputs.haskell-flake.flakeModule
inputs.treefmt-flake.flakeModule
inputs.check-flake.flakeModule
];
perSystem = { self', config, pkgs, ... }: {
haskellProjects.default = {
@ -22,6 +24,7 @@
inherit (pkgs)
treefmt;
} // config.treefmt.formatters;
enableHLSCheck = true;
};
treefmt.formatters = {
inherit (pkgs)

View file

@ -6,4 +6,7 @@ builds:
- "checks.aarch64-darwin.*"
- "devShells.x86_64-linux.default"
- "devShells.aarch64-darwin.default"
exclude: []
exclude:
# https://github.com/srid/haskell-flake/issues/21
- "checks.*.default-hls"
- "packages.*.check"

View file

@ -93,11 +93,11 @@ common shared
hs-source-dirs: src
other-modules: Lib
default-language: Haskell2010
executable haskell-template
import: shared
main-is: Main.hs
default-language: Haskell2010
import: shared
main-is: Main.hs
test-suite tests
import: shared