nixpkgs/pkgs/applications/graphics/xournal/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

66 lines
1.9 KiB
Nix

{ lib, stdenv, fetchurl, makeDesktopItem
, ghostscript, atk, gtk2, glib, fontconfig, freetype
, libgnomecanvas, libgnomeprint, libgnomeprintui
, pango, libX11, xorgproto, zlib, poppler
, autoconf, automake, libtool, pkgconfig}:
let
isGdkQuartzBackend = (gtk2.gdktarget == "quartz");
in
stdenv.mkDerivation rec {
version = "0.4.8.2016";
name = "xournal-" + version;
src = fetchurl {
url = "mirror://sourceforge/xournal/${name}.tar.gz";
sha256 = "09i88v3wacmx7f96dmq0l3afpyv95lh6jrx16xzm0jd1szdrhn5j";
};
buildInputs = [
ghostscript atk gtk2 glib fontconfig freetype
libgnomecanvas
pango libX11 xorgproto zlib poppler
] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
libgnomeprint libgnomeprintui
];
nativeBuildInputs = [ autoconf automake libtool pkgconfig ];
NIX_LDFLAGS = "-lz"
+ stdenv.lib.optionalString (!isGdkQuartzBackend) " -lX11";
desktopItem = makeDesktopItem {
name = name;
exec = "xournal";
icon = "xournal";
desktopName = "Xournal";
comment = meta.description;
categories = "Office;Graphics;";
mimeType = "application/pdf;application/x-xoj";
genericName = "PDF Editor";
};
postInstall=''
mkdir --parents $out/share/mime/packages
cat << EOF > $out/share/mime/packages/xournal.xml
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-xoj">
<comment>Xournal Document</comment>
<glob pattern="*.xoj"/>
</mime-type>
</mime-info>
EOF
cp --recursive ${desktopItem}/share/applications $out/share
mkdir --parents $out/share/icons
cp $out/share/xournal/pixmaps/xournal.png $out/share/icons
'';
meta = with lib; {
homepage = "http://xournal.sourceforge.net/";
description = "Note-taking application (supposes stylus)";
maintainers = [ maintainers.guibert ];
license = licenses.gpl2;
platforms = with platforms; linux ++ darwin;
};
}