1{
2 lib,
3 stdenv,
4 fetchurl,
5 unzip,
6 # If jdk is null, require JAVA_HOME in runtime environment, else store
7 # JAVA_HOME=${jdk.home} into grails.
8 jdk ? null,
9 coreutils,
10 ncurses,
11 gnused,
12 gnugrep, # for purity
13}:
14
15let
16 binpath = lib.makeBinPath (
17 [
18 coreutils
19 ncurses
20 gnused
21 gnugrep
22 ]
23 ++ lib.optional (jdk != null) jdk
24 );
25in
26stdenv.mkDerivation rec {
27 pname = "grails";
28 version = "7.0.0-M3";
29
30 src = fetchurl {
31 url = "https://github.com/grails/grails-core/releases/download/v${version}/grails-${version}.zip";
32 sha256 = "sha256-BM3fxmf86o+Ob63bE9aSCBh2MlkIS4AsYj7CZr/PVWU=";
33 };
34
35 nativeBuildInputs = [ unzip ];
36
37 dontBuild = true;
38
39 installPhase = ''
40 mkdir -p "$out"
41 cp -vr . "$out"
42 # Remove (for now) uneeded Windows .bat files
43 rm -f "$out"/bin/*.bat
44 # Improve purity
45 sed -i -e '2iPATH=${binpath}:\$PATH' "$out"/bin/grails
46 ''
47 + lib.optionalString (jdk != null) ''
48 # Inject JDK path into grails
49 sed -i -e '2iJAVA_HOME=${jdk.home}' "$out"/bin/grails
50 '';
51
52 preferLocalBuild = true;
53
54 meta = with lib; {
55 description = "Full stack, web application framework for the JVM";
56 mainProgram = "grails";
57 longDescription = ''
58 Grails is an Open Source, full stack, web application framework for the
59 JVM. It takes advantage of the Groovy programming language and convention
60 over configuration to provide a productive and stream-lined development
61 experience.
62 '';
63 homepage = "https://grails.org/";
64 license = licenses.asl20;
65 sourceProvenance = with sourceTypes; [ binaryBytecode ];
66 platforms = platforms.linux;
67 maintainers = [ maintainers.bjornfor ];
68 };
69}