Skip to content
Snippets Groups Projects
Commit 39a665bc authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Merge branch 'release-app' into 'main'

Add "release" and "cabal-test" app helpers

See merge request jcalderone/hs-flake-utils!3
parents 49696f70 2351f78d
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,7 @@ A nix flake for use with Haskell, for Least Authority.
];
};
packages = hslib.packages {};
apps.release = hslib.apps.release { };
});
}
```
......@@ -76,6 +76,48 @@ rec {
};
apps = {
# Using the working directory of `nix run`, do a build with cabal and
# then run the test suite.
cabal-test = { testTargetName ? "tests", preBuild ? "" }: {
type = "app";
program = "${
pkgs.writeShellApplication {
name = "cabal-build-and-test";
runtimeInputs = with pkgs; [
pkg-config haskell.compiler.${ghcVersion}
cabal-install
];
text = ''
set -ex
${preBuild}
cabal update hackage.haskell.org
cabal build --enable-tests
runtests=$(cabal list-bin --enable-tests ${testTargetName})
eval "$runtests"
'';
}
}/bin/cabal-build-and-test";
};
# Upload a candidate or (with `--publish`) publish a release.
release = { }: {
type = "app";
program = "${
pkgs.writeShellApplication {
name = "release";
runtimeInputs = with pkgs; [cabal-install];
text = ''
set -x
sdist=$(cabal sdist | tail -n 1)
haddocks=$(cabal haddock --haddock-for-hackage | tail -n 1)
cabal upload "$@" "$sdist"
cabal upload "$@" --documentation "$haddocks"
'';
}
}/bin/release";
};
# Create a program that runs hlint.
hlint = {
# An argv to pass to hlint in addition to any arguments passed on the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment