Skip to content

Instantly share code, notes, and snippets.

@yeus
Created January 4, 2025 21:45
Show Gist options
  • Save yeus/5c0ae50c3e2db72a4e3779677d30cbc5 to your computer and use it in GitHub Desktop.
Save yeus/5c0ae50c3e2db72a4e3779677d30cbc5 to your computer and use it in GitHub Desktop.
nix package definition for bigdata-file-viewer
{ pkgs ? import <nixpkgs> { }, ... }:
# we used this reference here to create the package:
# https://ryantm.github.io/nixpkgs/languages-frameworks/maven/#maven-buildmavenpackage
let jdk = pkgs.jdk21.override { enableJavaFX = true; };
in pkgs.maven.buildMavenPackage rec {
pname = "bigdata-file-viewer";
version = "1.1.1";
src = pkgs.fetchFromGitHub {
owner = "Eugene-Mark";
repo = pname;
rev = "v${version}";
hash = "sha256-mLCtIKBNJ2K+Kz4tC+FS98G941kIUDto4MdMrJ84I8Q=";
};
mvnJdk = jdk;
mvnParameters = toString [ "-Dmaven.test.skip" ];
mvnHash = "sha256-auErOIJm2e5c1YiwX5t2Lv/4OpFaCj21H0qgiasPzps=";
nativeBuildInputs = [ pkgs.makeWrapper pkgs.copyDesktopItems ];
installPhase = ''
mkdir -p $out/bin $out/share/${pname} $out/share/applications
echo "Looking for JAR file in target directory..."
find target -type f
jarFile=$(find target -name "${pname}-*.jar" -o -name "BigdataFileViewer-*.jar" | head -n 1)
if [ -z "$jarFile" ]; then
echo "Error: JAR file not found"
exit 1
fi
echo "JAR file found at: $jarFile"
install -Dm644 "$jarFile" $out/share/${pname}
makeWrapper ${jdk}/bin/java $out/bin/${pname} \
--add-flags "--add-modules javafx.web,javafx.fxml,javafx.swing,javafx.media" \
--add-flags "--add-opens=javafx.fxml/javafx.fxml=ALL-UNNAMED" \
--add-flags "-jar $out/share/${pname}/$(basename $jarFile)"
ln -s ${desktopItem}/share/applications/${pname}.desktop $out/share/applications/${pname}.desktop
'';
desktopItem = pkgs.makeDesktopItem {
name = "Bigdata File Viewer";
type = "Application";
exec = "${pname}";
icon = "table";
comment = "A tool to view big data files";
desktopName = "Bigdata File Viewer";
genericName = "File Viewer";
categories = [ "Utility" ];
};
meta = with pkgs.lib; {
description = "A tool to view big data files";
homepage = "https://github.com/Eugene-Mark/bigdata-file-viewer";
license = licenses.gpl2;
maintainers = with maintainers; [ yourself ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment