571c71e6f7
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.
78 lines
2.5 KiB
Nix
78 lines
2.5 KiB
Nix
{ lib, fetchFromGitHub, makeDesktopItem, copyDesktopItems, makeWrapper
|
|
, jre, maven
|
|
}:
|
|
|
|
let
|
|
pname = "digital";
|
|
pkgDescription = "A digital logic designer and circuit simulator.";
|
|
version = "0.31";
|
|
buildDate = "2024-09-03T14:02:31+02:00"; # v0.31 commit date
|
|
|
|
desktopItem = makeDesktopItem {
|
|
type = "Application";
|
|
name = pname;
|
|
desktopName = "Digital";
|
|
comment = "Easy-to-use digital logic designer and circuit simulator";
|
|
exec = pname;
|
|
icon = pname;
|
|
categories = [ "Education" "Electronics" ];
|
|
mimeTypes = [ "text/x-digital" ];
|
|
terminal = false;
|
|
keywords = [ "simulator" "digital" "circuits" ];
|
|
};
|
|
|
|
# Use the "no-git-rev" maven profile, which deactivates the plugin that
|
|
# inspect the .git folder to find the version number we are building, we then
|
|
# provide that version number manually as a property.
|
|
# (see https://github.com/hneemann/Digital/issues/289#issuecomment-513721481)
|
|
# Also use the commit date as a build and output timestamp.
|
|
mvnParameters = "-Pno-git-rev -Dgit.commit.id.describe=${version} -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}";
|
|
in
|
|
maven.buildMavenPackage rec {
|
|
inherit pname version jre;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "hneemann";
|
|
repo = "Digital";
|
|
rev = "v${version}";
|
|
hash = "sha256-6XaM3U1x/yvoCrkJ2nMtBmj972gCFlWn3F4DM7TLWgw=";
|
|
};
|
|
|
|
inherit mvnParameters;
|
|
mvnHash = "sha256-wm/axWJucoW9P98dKqHI4bjrUnmBTfosCOdJg9VBJ+4=";
|
|
|
|
nativeBuildInputs = [ copyDesktopItems makeWrapper ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
mkdir -p $out/share/java
|
|
|
|
classpath=$(find $mvnDeps/.m2 -name "*.jar" -printf ':%h/%f');
|
|
install -Dm644 target/Digital.jar $out/share/java
|
|
|
|
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 ];
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/hneemann/Digital";
|
|
description = pkgDescription;
|
|
mainProgram = "digital";
|
|
license = licenses.gpl3Only;
|
|
platforms = platforms.all;
|
|
maintainers = with maintainers; [ Dettorer ];
|
|
};
|
|
}
|