nixpkgs/pkgs/applications/graphics/drawio/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

96 lines
2.0 KiB
Nix

{ stdenv, lib, fetchurl, rpmextract, autoPatchelfHook, wrapGAppsHook
# Dynamic libraries
, alsaLib, atk, at-spi2-atk, at-spi2-core, cairo, dbus, cups, expat
, gdk-pixbuf, glib, gtk3, libX11, libXScrnSaver, libXcomposite, libXcursor
, libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXtst
, libxcb, libuuid, nspr, nss, pango
, systemd
}:
stdenv.mkDerivation rec {
pname = "drawio";
version = "14.1.5";
src = fetchurl {
url = "https://github.com/jgraph/drawio-desktop/releases/download/v${version}/draw.io-x86_64-${version}.rpm";
hash = "sha256-dM/DGtUDnJBD4Cfhm/zbxfgBhUcIlEzlF4z3cmQuW14=";
};
nativeBuildInputs = [
autoPatchelfHook
rpmextract
wrapGAppsHook
];
buildInputs = [
alsaLib
atk
at-spi2-atk
at-spi2-core
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
libX11
libXScrnSaver
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
libxcb
libuuid
nspr
nss
pango
systemd
];
runtimeDependencies = [
(lib.getLib systemd)
];
dontBuild = true;
dontConfigure = true;
unpackPhase = "rpmextract ${src}";
installPhase = ''
mkdir -p $out/share
cp -r opt/draw.io $out/share/
# Application icon
mkdir -p $out/share/icons/hicolor
cp -r usr/share/icons/hicolor/* $out/share/icons/hicolor/
# XDG desktop item
cp -r usr/share/applications $out/share/applications
# Symlink wrapper
mkdir -p $out/bin
ln -s $out/share/draw.io/drawio $out/bin/drawio
# Update binary path
substituteInPlace $out/share/applications/drawio.desktop \
--replace /opt/draw.io/drawio $out/bin/drawio
'';
meta = with lib; {
description = "A desktop application for creating diagrams";
homepage = "https://about.draw.io/";
license = licenses.asl20;
changelog = "https://github.com/jgraph/drawio-desktop/releases/tag/v${version}";
maintainers = with maintainers; [ danieldk ];
platforms = [ "x86_64-linux" ];
};
}