mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 21:40:12 +00:00
123 lines
3.3 KiB
Nix
123 lines
3.3 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
makeWrapper,
|
|
makeDesktopItem,
|
|
jdk25,
|
|
gradle_9,
|
|
copyDesktopItems,
|
|
jre25_minimal,
|
|
}:
|
|
|
|
let
|
|
jre = jre25_minimal.override {
|
|
modules = [
|
|
"java.base"
|
|
"java.compiler"
|
|
"java.desktop"
|
|
"java.instrument"
|
|
"java.naming"
|
|
"java.net.http"
|
|
"java.rmi"
|
|
"java.scripting"
|
|
"java.security.jgss"
|
|
"java.sql"
|
|
"jdk.attach"
|
|
"jdk.jdi"
|
|
"jdk.management"
|
|
"jdk.unsupported"
|
|
];
|
|
};
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "freerouting";
|
|
version = "2.4.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "freerouting";
|
|
repo = "freerouting";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-u466KolTd2zXRXljLSsxQWTIiVKCdVVcwO2Nm0zc00A=";
|
|
};
|
|
|
|
gradleBuildTask = "dist";
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
jdk25
|
|
gradle_9
|
|
copyDesktopItems
|
|
];
|
|
|
|
mitmCache = gradle_9.fetchDeps {
|
|
inherit (finalAttrs) pname;
|
|
data = ./deps.json;
|
|
};
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
gradleFlags = [ "--no-configuration-cache" ];
|
|
|
|
postPatch = ''
|
|
# Fix reproducibility: mock git revision, honor SOURCE_DATE_EPOCH, and normalize username
|
|
substituteInPlace build.gradle \
|
|
--replace-fail "commandLine('git', 'rev-parse', 'HEAD')" "commandLine('echo', 'v${finalAttrs.version}')" \
|
|
--replace-fail "def buildDateTime = new Date()" \
|
|
"def buildDateTime = new Date((System.getenv('SOURCE_DATE_EPOCH') ?: '0').toLong() * 1000); TimeZone.setDefault(TimeZone.getTimeZone('UTC'))" \
|
|
--replace-fail "System.properties['user.name']" "'nixbld'"
|
|
|
|
# Disable telemetry and contact options by default
|
|
substituteInPlace src/main/java/app/freerouting/settings/UserProfileSettings.java \
|
|
--replace-fail 'public Boolean isTelemetryAllowed = true;' 'public Boolean isTelemetryAllowed = false;'
|
|
substituteInPlace src/main/java/app/freerouting/settings/UserProfileSettings.java \
|
|
--replace-fail 'public Boolean isContactAllowed = true;' 'public Boolean isContactAllowed = false;'
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/{bin,share/freerouting}
|
|
cp build/dist/freerouting-executable.jar $out/share/freerouting
|
|
|
|
makeWrapper ${lib.getExe jre} $out/bin/freerouting \
|
|
--add-flags "-jar $out/share/freerouting/freerouting-executable.jar"
|
|
|
|
install -Dm644 ${finalAttrs.src}/assets/icon/freerouting_icon_256x256_v3.png \
|
|
$out/share/icons/hicolor/256x256/apps/freerouting.png
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
desktopItems = [
|
|
(makeDesktopItem {
|
|
name = finalAttrs.pname;
|
|
exec = "freerouting";
|
|
icon = "freerouting";
|
|
desktopName = "Freerouting";
|
|
comment = finalAttrs.meta.description;
|
|
categories = [
|
|
"Electricity"
|
|
"Engineering"
|
|
"Graphics"
|
|
];
|
|
})
|
|
];
|
|
|
|
meta = {
|
|
description = "Advanced PCB auto-router";
|
|
homepage = "https://www.freerouting.org";
|
|
changelog = "https://github.com/freerouting/freerouting/releases/tag/v${finalAttrs.version}";
|
|
longDescription = ''
|
|
Freerouting is an advanced autorouter for all PCB programs that support
|
|
the standard Specctra or Electra DSN interface. '';
|
|
license = lib.licenses.gpl3Only;
|
|
maintainers = with lib.maintainers; [
|
|
srounce
|
|
Misaka13514
|
|
];
|
|
platforms = with lib.platforms; linux ++ darwin;
|
|
mainProgram = "freerouting";
|
|
};
|
|
})
|