nixpkgs/pkgs/by-name/fr/frink/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

70 lines
1.8 KiB
Nix

{
fetchurl,
frink,
jdk,
lib,
rlwrap,
stdenv,
testers,
}:
stdenv.mkDerivation rec {
pname = "frink";
version = "2024-05-09";
src = fetchurl {
# Upstream does not provide versioned download links
url = "https://web.archive.org/web/20240605193919/https://frinklang.org/frinkjar/frink-tng.jar";
sha256 = "sha256-ceV1p9wsXprcNLhol79evswVZ1SpH5IzfSbl8st4cmU=";
};
dontUnpack = true;
nativeBuildInputs = [ jdk ];
buildInputs = [
jdk
rlwrap
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/lib
cp ${src} $out/lib/frink-tng.jar
# Generate rlwrap helper files.
# See https://frinklang.org/fsp/colorize.fsp?f=listUnits.frink
# and https://frinklang.org/fsp/colorize.fsp?f=listFunctions.frink
java -classpath "$out/lib/frink-tng.jar" frink.gui.FrinkStarter -e 'joinln[lexicalSort[units[]]]' > $out/lib/unitnames.txt
java -classpath "$out/lib/frink-tng.jar" frink.gui.FrinkStarter -e 'joinln[map[{|f|
f =~ %s/\s+//g
return "$f$"
}, lexicalSort[functions[]]]]' > $out/lib/functionnames.txt
cat > "$out/bin/frink" << EOF
#!${stdenv.shell}
exec ${rlwrap}/bin/rlwrap -f $out/lib/unitnames.txt -b '$' -f $out/lib/functionnames.txt ${jdk}/bin/java -classpath "$out/lib/frink-tng.jar" frink.gui.FrinkStarter "\$@"
EOF
chmod a+x "$out/bin/frink"
runHook postInstall
'';
meta = with lib; {
description = "Practical calculating tool and programming language";
homepage = "https://frinklang.org/";
license = licenses.unfree;
sourceProvenance = [ sourceTypes.binaryBytecode ];
maintainers = [ maintainers.stefanfehrenbach ];
};
passthru.tests = {
callFrinkVersion = testers.testVersion {
package = frink;
command = "frink -e 'FrinkVersion[]'";
};
};
}