17 pname = "electron-fiddle";
19 electron = electron_24;
22 src = fetchFromGitHub {
26 hash = "sha256-Iuss2xwts1aWy2rKYG7J2EvFdH8Bbedn/uZG2bi9UHw=";
29 # As of https://github.com/electron/fiddle/pull/1316 this is fetched
30 # from the network and has no stable hash. Grab an old version from
32 releasesJson = fetchurl {
33 url = "https://raw.githubusercontent.com/electron/fiddle/v0.32.4~18/static/releases.json";
34 hash = "sha256-1sxd3eJ6/WjXS6XQbrgKUTNUmrhuc1dAvy+VAivGErg=";
37 inherit (nodejs.pkgs) yarn;
38 offlineCache = fetchYarnDeps {
39 yarnLock = "${src}/yarn.lock";
40 hash = "sha256-dwhwUWwv6RYKEMdhRBvKVXvM8n1r+Qo0D3/uFsWIOpw=";
43 electronDummyMirror = "https://electron.invalid/";
44 electronDummyDir = "nix";
45 electronDummyFilename =
46 builtins.baseNameOf (builtins.head (electron.src.urls));
48 builtins.hashString "sha256" "${electronDummyMirror}${electronDummyDir}";
50 unwrapped = stdenvNoCC.mkDerivation {
51 pname = "${pname}-unwrapped";
54 nativeBuildInputs = [ fixup-yarn-lock git nodejs util-linux yarn zip ];
58 fixup-yarn-lock yarn.lock
59 yarn config --offline set yarn-offline-mirror ${offlineCache}
60 yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
61 patchShebangs node_modules
63 mkdir -p ~/.cache/electron/${electronDummyHash}
64 cp -ra '${electron}/libexec/electron' "$TMPDIR/electron"
65 chmod -R u+w "$TMPDIR/electron"
66 (cd "$TMPDIR/electron" && zip -0Xr ~/.cache/electron/${electronDummyHash}/${electronDummyFilename} .)
68 ln -s ${releasesJson} static/releases.json
72 ELECTRON_CUSTOM_VERSION='${electron.version}' \
73 ELECTRON_MIRROR='${electronDummyMirror}' \
74 ELECTRON_CUSTOM_DIR='${electronDummyDir}' \
75 ELECTRON_CUSTOM_FILENAME='${electronDummyFilename}' \
76 yarn --offline run package
80 mkdir -p "$out/lib/electron-fiddle/resources"
81 cp "out/Electron Fiddle-"*/resources/app.asar "$out/lib/electron-fiddle/resources/"
82 mkdir -p "$out/share/icons/hicolor/scalable/apps"
83 cp assets/icons/fiddle.svg "$out/share/icons/hicolor/scalable/apps/electron-fiddle.svg"
87 desktopItem = makeDesktopItem {
88 name = "electron-fiddle";
89 desktopName = "Electron Fiddle";
90 comment = "The easiest way to get started with Electron";
91 genericName = "Electron Fiddle";
92 exec = "electron-fiddle %U";
93 icon = "electron-fiddle";
95 categories = [ "GNOME" "GTK" "Utility" ];
96 mimeTypes = [ "x-scheme-handler/electron-fiddle" ];
101 name = "electron-fiddle";
102 runScript = "${electron}/bin/electron ${unwrapped}/lib/electron-fiddle/resources/app.asar";
104 extraInstallCommands = ''
105 mkdir -p "$out/share/icons/hicolor/scalable/apps"
106 ln -s "${unwrapped}/share/icons/hicolor/scalable/apps/electron-fiddle.svg" "$out/share/icons/hicolor/scalable/apps/"
107 mkdir -p "$out/share/applications"
108 cp "${desktopItem}/share/applications"/*.desktop "$out/share/applications/"
114 # for electron-fiddle itself
117 # for running Electron 22.0.0 inside
141 # for running Electron before 18.3.5/19.0.5/20.0.0 inside
144 # for running Electron before 16.0.0 inside
147 # for running Electron before 11.0.0 inside
153 # for running Electron before 10.0.0 inside
156 # for running Electron before 8.0.0 inside
159 # for running Electron before 4.0.0 inside
162 # for running Electron before 3.0.0 inside
165 # Electron 2.0.8 is the earliest working version, due to
166 # https://github.com/electron/electron/issues/13972
170 description = "The easiest way to get started with Electron";
171 homepage = "https://www.electronjs.org/fiddle";
172 license = licenses.mit;
173 maintainers = with maintainers; [ andersk ];
174 platforms = electron.meta.platforms;