diff options
author | Weijia Wang <9713184+wegank@users.noreply.github.com> | 2023-06-20 09:53:15 +0300 |
---|---|---|
committer | Weijia Wang <9713184+wegank@users.noreply.github.com> | 2023-06-20 09:53:15 +0300 |
commit | 06f73278ea94847f3adce6fa318367401a27c1fa (patch) | |
tree | 6204c82e0fa24f9374d88b4f13c3a77397c1635b /pkgs/applications/science/electronics/digital/default.nix | |
parent | fcb1400f3e18a2307dc29cc2f6b01be68d58a530 (diff) |
digital: convert to mavenfod
Diffstat (limited to 'pkgs/applications/science/electronics/digital/default.nix')
-rw-r--r-- | pkgs/applications/science/electronics/digital/default.nix | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/pkgs/applications/science/electronics/digital/default.nix b/pkgs/applications/science/electronics/digital/default.nix index 5f4df4f7cfecf..6eb0ef6d5bbc6 100644 --- a/pkgs/applications/science/electronics/digital/default.nix +++ b/pkgs/applications/science/electronics/digital/default.nix @@ -1,5 +1,5 @@ -{ lib, stdenv, fetchFromGitHub, makeDesktopItem, copyDesktopItems, makeWrapper -, jre, maven, git +{ lib, javaPackages, fetchFromGitHub, makeDesktopItem, copyDesktopItems, makeWrapper +, jre, maven }: let @@ -25,54 +25,29 @@ let # 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. - mvnOptions = "-Pno-git-rev -Dgit.commit.id.describe=${version} -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}"; + mvnParameters = "-Pno-git-rev -Dgit.commit.id.describe=${version} -Dproject.build.outputTimestamp=${buildDate} -DbuildTimestamp=${buildDate}"; in -stdenv.mkDerivation rec { +javaPackages.mavenfod rec { pname = "digital"; inherit version jre; src = fetchFromGitHub { owner = "hneemann"; repo = "Digital"; - rev = "932791eb6486d04f2ea938d83bcdb71b56d3a3f6"; - sha256 = "cDykYlcFvDLFBy9UnX07iCR2LCq28SNU+h9vRT/AoJM="; + rev = "v${version}"; + hash = "sha256-cDykYlcFvDLFBy9UnX07iCR2LCq28SNU+h9vRT/AoJM="; }; - # Fetching maven dependencies from "central" needs the network at build phase, - # we do that in this extra derivation that explicitly specifies its - # outputHash to ensure determinism. - mavenDeps = stdenv.mkDerivation { - name = "${pname}-${version}-maven-deps"; - inherit src nativeBuildInputs version; - dontFixup = true; - buildPhase = '' - mvn package ${mvnOptions} -Dmaven.repo.local=$out - ''; - # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with - # lastModified timestamps inside - installPhase = '' - find $out -type f \ - -name \*.lastUpdated -or \ - -name resolver-status.properties -or \ - -name _remote.repositories \ - -delete - ''; - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - outputHash = "1Cgw+5V2E/RENMRMm368+2yvY7y6v9gTlo+LRgrCXcE="; - }; + inherit mvnParameters; + mvnHash = "sha256-tc4mrXeyeI973IsNA9CcYJXEtTj91DcpCSmVYBYytt8="; nativeBuildInputs = [ copyDesktopItems maven makeWrapper ]; - buildPhase = '' - mvn package --offline ${mvnOptions} -Dmaven.repo.local=${mavenDeps} - ''; - installPhase = '' mkdir -p $out/bin mkdir -p $out/share/java - classpath=$(find ${mavenDeps} -name "*.jar" -printf ':%h/%f'); + classpath=$(find $mvnDeps/.m2 -name "*.jar" -printf ':%h/%f'); install -Dm644 target/Digital.jar $out/share/java makeWrapper ${jre}/bin/java $out/bin/${pname} \ |