nixpkgs-suyu/pkgs/applications/science/misc/netlogo/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

58 lines
1.8 KiB
Nix

{ jre, lib, stdenv, fetchurl, makeWrapper, makeDesktopItem }:
let
desktopItem = makeDesktopItem rec {
name = "netlogo";
exec = name;
icon = name;
comment = "A multi-agent programmable modeling environment";
desktopName = "NetLogo";
categories = "Science;";
};
in
stdenv.mkDerivation rec {
pname = "netlogo";
version = "6.1.1";
src = fetchurl {
url = "https://ccl.northwestern.edu/netlogo/${version}/NetLogo-${version}-64.tgz";
sha256 = "1j08df68pgggxqkmpzd369w4h97q0pivmmljdb48hjghx7hacblp";
};
src1 = fetchurl {
name = "netlogo.png";
url = "https://netlogoweb.org/assets/images/desktopicon.png";
sha256 = "1i43lhr31lzva8d2r0dxpcgr58x496gb5vmb0h2da137ayvifar8";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -pv $out/share/netlogo $out/share/icons/hicolor/256x256/apps $out/share/applications $out/share/doc
cp -rv app $out/share/netlogo
cp -v readme.md $out/share/doc/
# launcher with `cd` is required b/c otherwise the model library isn't usable
makeWrapper "${jre}/bin/java" "$out/bin/netlogo" \
--run "cd $out/share/netlogo/app" \
--add-flags "-jar netlogo-${version}.jar"
cp $src1 $out/share/icons/hicolor/256x256/apps/netlogo.png
cp ${desktopItem}/share/applications/* $out/share/applications
'';
meta = with lib; {
description = "A multi-agent programmable modeling environment";
longDescription = ''
NetLogo is a multi-agent programmable modeling environment. It is used by
many tens of thousands of students, teachers and researchers worldwide.
'';
homepage = "https://ccl.northwestern.edu/netlogo/index.shtml";
license = licenses.gpl2;
maintainers = [ maintainers.dpaetzel ];
platforms = platforms.linux;
};
}