nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 makeBinaryWrapper,
6 makeDesktopItem,
7 jdk,
8 gradle,
9 copyDesktopItems,
10 jre,
11}:
12stdenv.mkDerivation (finalAttrs: {
13 pname = "freerouting";
14 version = "2.1.0";
15
16 src = fetchFromGitHub {
17 owner = "freerouting";
18 repo = "freerouting";
19 tag = "v${finalAttrs.version}";
20 hash = "sha256-K4fwbvSPuKAAnIcTDBSAI1/6HuCB7c9rCGTJcyAj5dQ=";
21 };
22
23 gradleBuildTask = "executableJar";
24
25 nativeBuildInputs = [
26 makeBinaryWrapper
27 jdk
28 gradle
29 copyDesktopItems
30 ];
31
32 mitmCache = gradle.fetchDeps {
33 inherit (finalAttrs) pname;
34 data = ./deps.json;
35 };
36
37 __darwinAllowLocalNetworking = true;
38
39 installPhase = ''
40 runHook preInstall
41
42 mkdir -p $out/{bin,share/freerouting}
43 cp build/libs/freerouting-executable.jar $out/share/freerouting
44
45 makeWrapper ${lib.getExe jre} $out/bin/freerouting \
46 --add-flags "-jar $out/share/freerouting/freerouting-executable.jar"
47
48 install -Dm644 ${finalAttrs.src}/design/icon/freerouting_icon_256x256_v1.png \
49 $out/share/icons/hicolor/256x256/apps/freerouting.png
50
51 runHook postInstall
52 '';
53
54 desktopItems = [
55 (makeDesktopItem {
56 name = finalAttrs.pname;
57 exec = "freerouting";
58 icon = "freerouting";
59 desktopName = "Freerouting";
60 comment = finalAttrs.meta.description;
61 categories = [
62 "Electricity"
63 "Engineering"
64 "Graphics"
65 ];
66 })
67 ];
68
69 meta = {
70 description = "Advanced PCB auto-router";
71 homepage = "https://www.freerouting.org";
72 changelog = "https://github.com/freerouting/freerouting/releases/tag/v${finalAttrs.version}";
73 longDescription = ''
74 Freerouting is an advanced autorouter for all PCB programs that support
75 the standard Specctra or Electra DSN interface. '';
76 license = lib.licenses.gpl3Only;
77 maintainers = with lib.maintainers; [ srounce ];
78 platforms = with lib.platforms; linux ++ darwin;
79 mainProgram = "freerouting";
80 };
81})