Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
primary-key: nix-${{ hashFiles('npins/sources.json', 'nix/*.nix', '*.cabal') }}
restore-prefixes-first-match: nix-
- run: nix-build
- run: nix-build nix/ci.nix
- run: nix-shell --run "echo OK"
- run: nix-shell --run "cabal build"
- name: Cancel workflow on failure
Expand Down
37 changes: 37 additions & 0 deletions nix/ci.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{ sources ? import ../npins
, pkgs ? import ./pkgs.nix { inherit sources; }
, hpkgs ? import ./hpkgs.nix { inherit pkgs; }
,
}:
let
# The fileset filter on ../nix/hpkgs.nix already keeps the haskell
# build from being invalidated by edits to .hlint.yaml, so we can
# safely use the wider tree here without thrashing the cabal cache.
src = builtins.path {
path = ../.;
name = "template-project-src";
filter = path: _type:
let base = baseNameOf (toString path);
in !(builtins.elem base [ "dist-newstyle" "dist" "result" ".git" ]);
};
in
{
# The cabal build / library / executable derivation — what
# 'nix-build' has always built. Kept here so CI builds the project
# /and/ the hlint pass with a single 'nix-build nix/ci.nix' rather
# than two separate invocations.
native = import ../default.nix { inherit hpkgs; };

# Enforce .hlint.yaml across app/src/test as part of CI. Treating
# hlint as a derivation lets the same 'nix-build nix/ci.nix' run
# locally and in GitHub Actions, and keeps the hlint version pinned
# to the same nixpkgs as the rest of the toolchain.
hlint = pkgs.runCommand "ci-hlint"
{
nativeBuildInputs = [ pkgs.hlint ];
} ''
cd ${src}
hlint -h .hlint.yaml app src test
touch $out
'';
}
Loading