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