blob: d2e8d514b0b5c8515d1d36f9566c7c2765e7740c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{ compiler ? "default" }: let
stockholm = import <stockholm>;
inherit (stockholm.systems.${lib.krops.getHostName}) config pkgs;
inherit (stockholm) lib;
haskellPackages =
if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
drv = haskellPackages.callPackage (import ./.) {};
in
lib.overrideDerivation drv.env (oldAttrs: {
buildInputs = [
pkgs.flameshot
];
shellHook = ''
pkg_name=${lib.escapeShellArg (builtins.baseNameOf (toString ./.))}
WORKDIR=${lib.escapeShellArg (toString ./.)}
CACHEDIR=$HOME/tmp/$pkg_name
HISTFILE=$CACHEDIR/bash_history
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"
'';
})
|