feat(school): add teacher's RARS fork to packages
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-01-16 14:36:51 -05:00
parent 2f4781e60e
commit 841be58331
2 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,100 @@
{
stdenvNoCC,
jre,
fetchFromGitHub,
fetchurl,
makeWrapper,
makeDesktopItem,
rsync,
...
}:
stdenvNoCC.mkDerivation rec {
name = "rars-flatlaf";
src = fetchFromGitHub {
owner = "privat";
repo = "rars";
rev = "fd34014efd65b3cb5a52f1729c3b8240cae0c332";
hash = "sha256-D8X/cr+fnq/OOFYfMG9aPss95J8Z2yiROuF9kmHkK40=";
fetchSubmodules = true;
};
desktopItem = makeDesktopItem {
name = "RARS";
desktopName = "RARS";
exec = name;
icon = name;
};
nativeBuildInputs = [makeWrapper rsync jre];
installPhase = let
flatlaf = fetchurl {
url = "https://repo1.maven.org/maven2/com/formdev/flatlaf/3.2/flatlaf-3.2.jar";
hash = "sha256-HAG+G9undDXWtySokKl7lkIUCFI7lEBduu+UgSVaxAA=";
};
icon = fetchurl {
url = "https://riscv.or.jp/wp-content/uploads/2019/06/cropped-RISC-V-logo-figonly-mod-2.png";
hash = "sha256-e1/iVmadVzyO77ikBr1cdXsJdDj8TiXh3Oyjek9GwqM=";
};
in
/*
bash
*/
''
# ./build-jar.sh
mkdir -p build
find src -name "*.java" | xargs javac --release 8 -d build
if [[ "$OSTYPE" == "darwin"* ]]; then
find src -type f -not -name "*.java" -exec rsync -R {} build \;
else
find src -type f -not -name "*.java" -exec cp --parents {} build \;
fi
cp -rf build/src/* build
rm -r build/src
cp README.md License.txt build
cd build
jar cfm ../rars.jar ./META-INF/MANIFEST.MF *
chmod +x ../rars.jar
cd ..
# ./build-jar-flatlaf.sh
mkdir -p build-flatlaf/
cd build-flatlaf/
cp ${flatlaf} ../flatlaf.jar
jar x < ../rars.jar
jar x < "../flatlaf.jar"
cat > META-INF/MANIFEST.MF <<EOF
Manifest-Version: 1.0
Implementation-Version: 3.1.1
Multi-Release: true
Main-Class: rars.Launch
EOF
jar cfm ../rars-flatlaf.jar META-INF/MANIFEST.MF *
chmod +x ../rars-flatlaf.jar
cd ..
# InstallPhase
runHook preInstall
cat > ./rars.desktop <<EOF
EOF
mkdir -p "$out/share/pixmaps"
cp "${icon}" "$out/share/pixmaps/${name}.png"
install -D $desktopItem/share/applications/* $out/share/applications/rars.desktop
export JAR=$out/share/java/${name}/${name}.jar
install -D ./${name}.jar $JAR
makeWrapper ${jre}/bin/java $out/bin/${name} \
--add-flags "-jar $JAR"
runHook postInstall
'';
}

View file

@ -221,6 +221,7 @@ in {
libreoffice-fresh # TODO: declarative conf?
hunspell
hunspellDicts.en_CA
config.customPkgs.rars-flatlaf
# Apps
thunderbird # TODO: use programs.thunderbird