digital: fix desktop item and copy icons (#305171)

* digital: refactor desktopItem

fix desktopName
change name, exec and icon to pname

* digital: refactor installPhase

copy icons
run pre and post install hooks (we need postInstall to actually run copyDesktopItems)
This commit is contained in:
Pixis 2024-05-02 15:42:04 +02:00 committed by GitHub
parent b823e90023
commit b87a96cf1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,17 +3,18 @@
}:
let
pname = "digital";
pkgDescription = "A digital logic designer and circuit simulator.";
version = "0.30";
buildDate = "2023-02-03T08:00:56+01:00"; # v0.30 commit date
desktopItem = makeDesktopItem {
type = "Application";
name = "Digital";
desktopName = pkgDescription;
name = pname;
desktopName = "Digital";
comment = "Easy-to-use digital logic designer and circuit simulator";
exec = "digital";
icon = "digital";
exec = pname;
icon = pname;
categories = [ "Education" "Electronics" ];
mimeTypes = [ "text/x-digital" ];
terminal = false;
@ -28,8 +29,7 @@ let
mvnParameters = "-Pno-git-rev -Dgit.commit.id.describe=${version} -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}";
in
maven.buildMavenPackage rec {
pname = "digital";
inherit version jre;
inherit pname version jre;
src = fetchFromGitHub {
owner = "hneemann";
@ -44,6 +44,8 @@ maven.buildMavenPackage rec {
nativeBuildInputs = [ copyDesktopItems makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/share/java
@ -53,6 +55,13 @@ maven.buildMavenPackage rec {
makeWrapper ${jre}/bin/java $out/bin/${pname} \
--add-flags "-classpath $out/share/java/${pname}-${version}.jar:''${classpath#:}" \
--add-flags "-jar $out/share/java/Digital.jar"
install -Dm644 src/main/svg/icon.svg $out/share/icons/hicolor/scalable/apps/${pname}.svg
for size in 16 32 48 64 128; do
install -Dm644 src/main/resources/icons/icon"$size".png $out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png
done
runHook postInstall
'';
desktopItems = [ desktopItem ];