From f0e8d1b9041662ec07eae33d3c03109e2abcf6e8 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 1 May 2020 01:33:13 +0200 Subject: shell.nix: add build and run --- shell.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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" ''; -- cgit v1.2.3