mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 01:33:10 +00:00
digital: init at 0.29
This commit is contained in:
parent
edb47c9685
commit
dbb732a8f2
99
pkgs/applications/science/electronics/digital/default.nix
Normal file
99
pkgs/applications/science/electronics/digital/default.nix
Normal file
@ -0,0 +1,99 @@
|
||||
{ lib, stdenv, fetchFromGitHub, makeDesktopItem, copyDesktopItems, makeWrapper
|
||||
, jre, maven, git
|
||||
}:
|
||||
|
||||
let
|
||||
pkgDescription = "A digital logic designer and circuit simulator.";
|
||||
version = "0.29";
|
||||
buildDate = "2022-02-11T18:10:34+01:00"; # v0.29 commit date
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
type = "Application";
|
||||
name = "Digital";
|
||||
desktopName = pkgDescription;
|
||||
comment = "Easy-to-use digital logic designer and circuit simulator";
|
||||
exec = "digital";
|
||||
icon = "digital";
|
||||
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)
|
||||
mvnOptions = "-Pno-git-rev -Dgit.commit.id.describe=${version} -Dproject.build.outputTimestamp=${buildDate}";
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "digital";
|
||||
inherit version jre;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "hneemann";
|
||||
repo = "Digital";
|
||||
rev = "287dd939d6f2d4d02c0d883c6178c3425c28d39c";
|
||||
sha256 = "o5gaExUTTbk6WgQVw7/IeXhpNkj1BLkwD752snQqjIg=";
|
||||
};
|
||||
|
||||
# Use fixed dates in the pom.xml and upgrade the jar and assembly plugins to
|
||||
# a version where they support reproducible builds
|
||||
patches = [ ./pom.xml.patch ];
|
||||
|
||||
# Fetching maven dependencies from "central" needs the network at build phase,
|
||||
# we do that in this extra derivation that explicitely specifies its
|
||||
# outputHash to ensure determinism.
|
||||
mavenDeps = stdenv.mkDerivation {
|
||||
name = "${pname}-${version}-maven-deps";
|
||||
inherit src nativeBuildInputs version patches postPatch;
|
||||
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 = "X5ppGUVwNQrMnjzD4Kin1Xmt4O3x+qr7jK4jr6E8tCI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ copyDesktopItems maven makeWrapper ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pom.xml --subst-var-by buildDate "${buildDate}"
|
||||
'';
|
||||
|
||||
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');
|
||||
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"
|
||||
'';
|
||||
|
||||
desktopItems = [ desktopItem ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/hneemann/Digital";
|
||||
description = pkgDescription;
|
||||
license = licenses.gpl3Only;
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
||||
maintainers = with maintainers; [ Dettorer ];
|
||||
};
|
||||
}
|
30
pkgs/applications/science/electronics/digital/pom.xml.patch
Normal file
30
pkgs/applications/science/electronics/digital/pom.xml.patch
Normal file
@ -0,0 +1,30 @@
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index d5f8330b4..58ed18b63 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -129,7 +130,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
- <version>2.5</version>
|
||||
+ <version>3.2.0</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
@@ -188,6 +189,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
+ <version>3.2.0</version>
|
||||
<configuration>
|
||||
<finalName>Digital</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
@@ -202,7 +204,7 @@
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Build-SCM-Revision>${git.commit.id.describe}</Build-SCM-Revision>
|
||||
- <Build-Time>${maven.build.timestamp}</Build-Time>
|
||||
+ <Build-Time>@buildDate@</Build-Time>
|
||||
<SplashScreen-Image>icons/splash.png</SplashScreen-Image>
|
||||
</manifestEntries>
|
||||
</archive>
|
@ -28321,6 +28321,8 @@ with pkgs;
|
||||
|
||||
dia = callPackage ../applications/graphics/dia { };
|
||||
|
||||
digital = callPackage ../applications/science/electronics/digital {};
|
||||
|
||||
direwolf = callPackage ../applications/radio/direwolf {
|
||||
hamlib = hamlib_4;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user