summaryrefslogtreecommitdiffstats
path: root/shell.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-05-01 01:33:13 +0200
committertv <tv@krebsco.de>2020-05-01 01:33:13 +0200
commitf0e8d1b9041662ec07eae33d3c03109e2abcf6e8 (patch)
treeb5e88ff4926c75b11cda88e1cf354e550e60050c /shell.nix
parentcebaefa37095e74ad2253c4e2f9d9ab390f88737 (diff)
shell.nix: add build and run
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/shell.nix b/shell.nix
index 4d7e83a..d2e8d51 100644
--- a/shell.nix
+++ b/shell.nix
@@ -28,7 +28,28 @@ in
mkdir -p "$CACHEDIR"
+ exe=$CACHEDIR/${lib.currentSystem}
+
+ build() {(
+ set -efu
+ cd "$WORKDIR"
+ options=$(
+ ${pkgs.cabal-read}/bin/ghc-options "$pkg_name.cabal" "$pkg_name"
+ )
+ exec ghc $options \
+ -isrc \
+ -odir "$CACHEDIR" \
+ -hidir "$CACHEDIR" \
+ -o "$exe" \
+ src/main.hs
+ )}
+
+ run() {(
+ exec "$exe" "$@"
+ )}
+
export SHELL=/run/current-system/sw/bin/bash
+ export FLAMESHOT_CAPTURE_PATH="$CACHEDIR/captures"
cd "$WORKDIR"
'';