nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 appstream,
3 buildNpmPackage,
4 cargo,
5 cmake,
6 desktop-file-utils,
7 fetchFromGitHub,
8 gtk4,
9 gtksourceview5,
10 lib,
11 libadwaita,
12 meson,
13 ninja,
14 nix-update-script,
15 pkg-config,
16 rustPlatform,
17 rustc,
18 stdenv,
19 webkitgtk_6_0,
20 wrapGAppsHook4,
21}:
22let
23 d3-graphviz = buildNpmPackage rec {
24 pname = "d3-graphviz";
25 version = "5.6.0";
26
27 src = fetchFromGitHub {
28 owner = "magjac";
29 repo = "d3-graphviz";
30 tag = "v${version}";
31 hash = "sha256-MZhAzR6+GIBTsLPJq5NqaEPHjiBMgYBJ0hFbDPNPgFk=";
32 };
33
34 npmDepsHash = "sha256-J1kptumP/8UoiYDM+AJOYUne0OSkMXCTAXW3ZmavU4E=";
35
36 # keep the devDependencies, as Delineate imports d3 via node_modules
37 # https://github.com/SeaDve/Delineate/blob/v0.1.0/data/graph_view/index.html#L10-L11
38 npmPruneFlags = "--include=dev";
39 };
40in
41stdenv.mkDerivation (finalAttrs: {
42 pname = "delineate";
43 version = "0.1.0";
44
45 src = fetchFromGitHub {
46 owner = "SeaDve";
47 repo = "Delineate";
48 tag = "v${finalAttrs.version}";
49 hash = "sha256-dFGh7clxc6UxQRTsNKrggWDvL3CPmzJmrvO1jqMVoTg=";
50 };
51
52 cargoDeps = rustPlatform.fetchCargoVendor {
53 inherit (finalAttrs) src;
54 hash = "sha256-RtQnpbjULtnvlc71L4KIKPES0WRSY2GoaIwt8UvlYOA=";
55 };
56
57 patches = [
58 ./graphview-dir.patch
59 ];
60
61 nativeBuildInputs = [
62 cargo
63 cmake
64 desktop-file-utils
65 gtk4
66 meson
67 ninja
68 pkg-config
69 rustPlatform.bindgenHook
70 rustPlatform.cargoSetupHook
71 rustc
72 wrapGAppsHook4
73 ];
74
75 buildInputs = [
76 appstream
77 gtksourceview5
78 libadwaita
79 webkitgtk_6_0
80 ];
81
82 dontUseCmakeConfigure = true;
83
84 postInstall = ''
85 ln -s ${d3-graphviz}/lib/node_modules/d3-graphviz $out/opt/delineate/graph_view/d3-graphviz
86 '';
87
88 passthru.updateScript = nix-update-script { };
89
90 meta = {
91 description = "View and edit graphs";
92 homepage = "https://github.com/SeaDve/Delineate";
93 changelog = "https://github.com/SeaDve/Delineate/releases/tag/v${finalAttrs.version}";
94 license = lib.licenses.gpl3Plus;
95 maintainers = [ lib.maintainers.nekowinston ];
96 platforms = lib.platforms.linux;
97 mainProgram = "delineate";
98 };
99})