nixpkgs/pkgs/development/web/grails/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

53 lines
1.5 KiB
Nix

{ lib, stdenv, fetchurl, unzip
# If jdk is null, require JAVA_HOME in runtime environment, else store
# JAVA_HOME=${jdk.home} into grails.
, jdk ? null
, coreutils, ncurses, gnused, gnugrep # for purity
}:
let
binpath = stdenv.lib.makeBinPath
([ coreutils ncurses gnused gnugrep ] ++ stdenv.lib.optional (jdk != null) jdk);
in
stdenv.mkDerivation rec {
pname = "grails";
version = "4.1.0.M1";
src = fetchurl {
url = "https://github.com/grails/grails-core/releases/download/v${version}/grails-${version}.zip";
sha256 = "0l99x3g485qjpdd7ga553xpi1s6rq21p8v16qjzqwdhyld961qsr";
};
buildInputs = [ unzip ];
dontBuild = true;
installPhase = ''
mkdir -p "$out"
cp -vr . "$out"
# Remove (for now) uneeded Windows .bat files
rm -f "$out"/bin/*.bat
# Improve purity
sed -i -e '2iPATH=${binpath}:\$PATH' "$out"/bin/grails
'' + stdenv.lib.optionalString (jdk != null) ''
# Inject JDK path into grails
sed -i -e '2iJAVA_HOME=${jdk.home}' "$out"/bin/grails
'';
preferLocalBuild = true;
meta = with lib; {
description = "Full stack, web application framework for the JVM";
longDescription = ''
Grails is an Open Source, full stack, web application framework for the
JVM. It takes advantage of the Groovy programming language and convention
over configuration to provide a productive and stream-lined development
experience.
'';
homepage = "https://grails.org/";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
}