2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchYarnDeps
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
|
|
|
, desktopToDarwinBundle
|
|
|
|
, fixup_yarn_lock
|
|
|
|
, makeWrapper
|
|
|
|
, nodejs
|
|
|
|
, yarn
|
|
|
|
, electron
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "drawio";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "22.0.2";
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jgraph";
|
|
|
|
repo = "drawio-desktop";
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-L+tbNCokVoiS2KkaPVBjG7H/8cqz1e8dlXC5H8BkPvU=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
offlineCache = fetchYarnDeps {
|
|
|
|
yarnLock = src + "/yarn.lock";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-d8AquOKdrPQHBhRG9o1GB18LpwlwQK6ZaM1gLAcjilM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-05-24 13:37:59 +00:00
|
|
|
copyDesktopItems
|
|
|
|
fixup_yarn_lock
|
|
|
|
makeWrapper
|
|
|
|
nodejs
|
|
|
|
yarn
|
|
|
|
] ++ lib.optional stdenv.isDarwin desktopToDarwinBundle;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
ELECTRON_SKIP_BINARY_DOWNLOAD = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
|
|
|
|
export HOME="$TMPDIR"
|
|
|
|
yarn config --offline set yarn-offline-mirror "$offlineCache"
|
|
|
|
fixup_yarn_lock yarn.lock
|
|
|
|
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
|
|
|
patchShebangs node_modules/
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
runHook postConfigure
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
yarn --offline run electron-builder --dir \
|
|
|
|
--config electron-builder-linux-mac.json \
|
2023-10-09 19:29:22 +00:00
|
|
|
-c.electronDist=${electron}/libexec/electron \
|
2023-05-24 13:37:59 +00:00
|
|
|
-c.electronVersion=${electron.version}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
runHook postBuild
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
mkdir -p "$out/share/lib/drawio"
|
|
|
|
cp -r dist/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/drawio"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
install -Dm644 build/icon.svg "$out/share/icons/hicolor/scalable/apps/drawio.svg"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
makeWrapper '${electron}/bin/electron' "$out/bin/drawio" \
|
|
|
|
--add-flags "$out/share/lib/drawio/resources/app.asar" \
|
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
|
|
|
--inherit-argv0
|
2022-01-23 02:10:13 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
runHook postInstall
|
2022-01-23 02:10:13 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "drawio";
|
|
|
|
exec = "drawio %U";
|
|
|
|
icon = "drawio";
|
|
|
|
desktopName = "drawio";
|
|
|
|
comment = "draw.io desktop";
|
|
|
|
mimeTypes = [ "application/vnd.jgraph.mxfile" "application/vnd.visio" ];
|
|
|
|
categories = [ "Graphics" ];
|
2023-10-09 19:29:22 +00:00
|
|
|
startupWMClass = "draw.io";
|
2023-05-24 13:37:59 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A desktop application for creating diagrams";
|
|
|
|
homepage = "https://about.draw.io/";
|
|
|
|
license = licenses.asl20;
|
2020-08-20 17:08:02 +00:00
|
|
|
changelog = "https://github.com/jgraph/drawio-desktop/releases/tag/v${version}";
|
2023-05-24 13:37:59 +00:00
|
|
|
maintainers = with maintainers; [ qyliss darkonion0 ];
|
|
|
|
platforms = platforms.darwin ++ platforms.linux;
|
|
|
|
broken = stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|