-
Notifications
You must be signed in to change notification settings - Fork 25
/
default.nix
78 lines (58 loc) · 2.02 KB
/
default.nix
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{ mkDerivation, stdenv
, autoconf, c2hs
, fltk, libjpeg, mesa
, base, bytestring, Cabal, directory, filepath, mtl, OpenGLRaw, parsec, text
, cabalFlags ? {}
}:
/*
This file is written manually, not generated automatically, because
cabal2nix doesn't provision correctly for this package's complex custom setup.
*/
let
# "import" utilities
inherit (stdenv.lib) mapAttrs attrValues concatStringsSep optionals;
flags
= { bundled = false; demos = true; opengl = false; } # same names/defaults as the cabal flags
// cabalFlags; # override defaults with any extra flags
# NOTE `bundled` is currently ignored.
nixSet2cabalInstallOptions = inputFlags:
let outputFlags =
(attrValues # e.g. [ "-f-bundled" "-fdemos" "-f-opengl" ]
(mapAttrs (k: v: (if v then "-f" else "-f-") + k) # e.g. { bundled = "-f-bundled"; demos = "-fdemos"; opengl = "-f-opengl"; }
inputFlags)); # e.g. { bundled = false; demos = true; opengl = false; }
in outputFlags;
in
mkDerivation {
pname = "fltkhs";
version = "0.5.4.3";
homepage = "http://github.com/deech/fltkhs";
description = "FLTK bindings";
license = stdenv.lib.licenses.mit;
src = ./.;
isLibrary = true;
isExecutable = true;
# including .cabal `flag`s
configureFlags = nixSet2cabalInstallOptions flags;
# `custom-setup`
setupHaskellDepends = [ autoconf base c2hs Cabal directory filepath ];
# ^ `setup-depends`
# `library`
libraryToolDepends = [ autoconf c2hs fltk ];
# ^ `build-tools:`
# fltk provides fltk-config
libraryHaskellDepends = [ base bytestring text ];
# ^ `build-depends:`
librarySystemDepends = [
fltk libjpeg
] ++ optionals flags.opengl [
mesa
];
# ^ `extra-libraries:`
# all the `executable`s
executableHaskellDepends = [
base directory filepath mtl parsec text
] ++ optionals flags.opengl [
OpenGLRaw
];
# ^ `build-depends:`
}