-
Notifications
You must be signed in to change notification settings - Fork 19
/
top-level.nix
189 lines (160 loc) · 5.2 KB
/
top-level.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
{ config, options, lib, pkgs, ... }:
let types = lib.types; in
{
options = {
jdk = lib.mkOption {
type = types.package;
default = pkgs.jdk_headless;
defaultText = lib.literalExpression "pkgs.jdk_headless";
description = lib.mdDoc "JDK used to build and run the application.";
};
projectSrc = lib.mkOption {
type = types.path;
description = lib.mdDoc "Project source code.";
example = lib.literalExpression "./.";
};
name = lib.mkOption {
type = types.str;
description = lib.mdDoc "Name of the clojure project. Needs to include the namespace.";
example = "myorg/project";
};
version = lib.mkOption {
default = "DEV";
type = types.str;
description = lib.mdDoc "Derivation and clojure project version";
};
main-ns = lib.mkOption {
type = types.str;
description = lib.mdDoc
''
Main clojure namespace. A `-main` function is expected here.
`main-ns` file must include the :gen-class directive, e.g.: `(ns foo (:gen-class))`
'';
};
java-opts = lib.mkOption {
type = types.listOf types.str;
default = [ ];
description = lib.mdDoc "List of Java options to include in the application wrapper";
};
buildCommand = lib.mkOption {
default = null;
type = types.nullOr types.str;
description = lib.mdDoc "Command to build the jar application. If not provided, a default builder is used";
};
builder-extra-inputs = lib.mkOption {
default = [ ];
type = types.listOf types.package;
description = lib.mdDoc "Extra inputs to the default builder";
};
builder-java-opts = lib.mkOption {
type = types.listOf types.str;
default = [ ];
description = lib.mdDoc "List of Java options to include in default builder command";
};
builder-preBuild = lib.mkOption {
default = "";
type = types.str;
description = lib.mdDoc "Pre build commands for the default builder";
};
builder-postBuild = lib.mkOption {
default = "";
type = types.str;
description = lib.mdDoc "Post build commands for the default builder";
};
lockfile = lib.mkOption {
default = null;
type = types.nullOr types.str;
description = lib.mdDoc "The lock file";
};
compileCljOpts = lib.mkOption {
default = null;
description = lib.mdDoc "Override options passed to compile-clj";
type = types.anything;
};
javacOpts = lib.mkOption {
default = null;
description = lib.mdDoc "Options passed to javac. Needed if the projects contains java source files";
type = types.nullOr (
(types.submodule {
options.src-dirs = lib.mkOption {
type = types.listOf types.str;
};
options.javac-opts = lib.mkOption {
default = [ ];
type = types.nullOr (types.listOf types.str);
};
})
);
};
withLeiningen = lib.mkOption {
default = false;
description = lib.mdDoc "Enable it to invoke leiningen during the build";
type = types.bool;
};
###
# Options for customJdk
###
customJdk = lib.mkOption {
default = { };
type = types.submodule {
options = {
enable = lib.mkOption {
default = false;
type = types.bool;
description = lib.mdDoc ''
Creates a custom JDK runtime with `jlink`.
'';
};
jdkModules = lib.mkOption {
default = null;
type = types.nullOr types.str;
description = lib.mdDoc ''
Option passed to `jlink --add-modules`.
If `null`, `jdeps` will be used to analyze the uberjar'';
};
extraJdkModules = lib.mkOption {
default = [ ];
type = types.listOf types.str;
description = lib.mdDoc "Extra JDK modules appended to `jdkModules`";
};
locales = lib.mkOption {
default = null;
type = types.nullOr types.str;
description = lib.mdDoc "Option passed to `jlink --include-locales`";
};
};
};
};
###
# Options for nativeImage ()
###
nativeImage = lib.mkOption {
default = { };
type = types.submodule {
options = {
enable = lib.mkOption {
default = false;
type = types.bool;
description = lib.mdDoc "Generates a binary with GraalVM";
};
graalvm = lib.mkOption {
default = pkgs.graalvm-ce;
defaultText = lib.literalExpression "pkgs.graalvm-ce";
type = types.package;
description = lib.mdDoc "GraalVM used at build time";
};
extraNativeImageBuildArgs = lib.mkOption {
default = [ ];
type = types.listOf types.str;
description = lib.mdDoc "Extra arguments to be passed to the native-image command";
};
graalvmXmx = lib.mkOption {
default = "-J-Xmx6g";
type = types.str;
description = lib.mdDoc "XMX size of GraalVM during build";
};
};
};
};
};
}