1{
2 stdenv,
3 lib,
4 fetchurl,
5 unzip,
6 udev,
7 nwjs,
8 gcc-unwrapped,
9 autoPatchelfHook,
10 gsettings-desktop-schemas,
11 gtk3,
12 wrapGAppsHook3,
13 makeWrapper,
14 pinegrowVersion ? "7",
15}:
16
17let
18 # major version upgrade requires a new license. So keep version 6 around.
19 versions = {
20 "6" = {
21 version = "6.8";
22 src = fetchurl {
23 url = "https://download.pinegrow.com/PinegrowLinux64.${versions."6".version}.zip";
24 hash = "sha256-gqRmu0VR8Aj57UwYYLKICd4FnYZMhM6pTTSGIY5MLMk=";
25 };
26 };
27 "7" = {
28 version = "7.8";
29 src = fetchurl {
30 url = "https://github.com/Pinegrow/PinegrowReleases/releases/download/pg${
31 builtins.substring 0 4 (versions."7".version)
32 }/PinegrowLinux64.${versions."7".version}.zip";
33 hash = "sha256-tYQfPfzKRwClNwgSoJfMwG3LHhi3O/iFuuwIVHS8OXk=";
34 };
35 };
36 };
37in
38
39stdenv.mkDerivation {
40 pname = "pinegrow";
41 # deactivate auto update, because an old 6.21 version is getting mixed up
42 # see e.g. https://github.com/NixOS/nixpkgs/pull/184460
43 version = versions.${pinegrowVersion}.version; # nixpkgs-update: no auto update
44
45 src = versions.${pinegrowVersion}.src;
46
47 nativeBuildInputs = [
48 unzip
49 autoPatchelfHook
50 makeWrapper
51 wrapGAppsHook3
52 ];
53
54 buildInputs = [
55 udev
56 nwjs
57 gcc-unwrapped
58 gsettings-desktop-schemas
59 gtk3
60 ];
61
62 dontWrapGApps = true;
63 makeWrapperArgs = [
64 "--prefix LD_LIBRARY_PATH : ${
65 lib.makeLibraryPath [
66 gcc-unwrapped.lib
67 gtk3
68 udev
69 ]
70 }"
71 "--prefix PATH : ${lib.makeBinPath [ stdenv.cc ]}"
72 ];
73
74 sourceRoot = ".";
75
76 dontUnpack = true;
77
78 # Extract and copy executable in $out/bin
79 installPhase = ''
80 runHook preInstall
81
82 mkdir -p $out/share/applications $out/bin $out/opt/bin
83 # we can't unzip it in $out/lib, because nw.js will start with
84 # an empty screen. Therefore it will be unzipped in a non-typical
85 # folder and symlinked.
86 unzip -q $src -d $out/opt/pinegrow
87 substituteInPlace $out/opt/pinegrow/Pinegrow.desktop \
88 --replace 'Exec=sh -c "$(dirname %k)/PinegrowLibrary"' 'Exec=sh -c "$out/bin/pinegrow"'
89 mv $out/opt/pinegrow/Pinegrow.desktop $out/share/applications/pinegrow.desktop
90 ln -s $out/opt/pinegrow/PinegrowLibrary $out/bin/pinegrow
91
92 runHook postInstall
93 '';
94
95 # GSETTINGS_SCHEMAS_PATH is not set in installPhase
96 preFixup = ''
97 wrapProgram $out/bin/pinegrow \
98 ''${makeWrapperArgs[@]} \
99 ''${gappsWrapperArgs[@]}
100 '';
101
102 meta = with lib; {
103 homepage = "https://pinegrow.com";
104 description = "UI Web Editor";
105 platforms = [ "x86_64-linux" ];
106 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
107 license = with licenses; [ unfreeRedistributable ];
108 maintainers = with maintainers; [ gador ];
109 mainProgram = "pinegrow";
110 };
111}