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

103 lines
2.5 KiB
Nix

{ lib, stdenv, makeDesktopItem, fetchurl, unzip
, gdk-pixbuf, glib, gtk3, atk, at-spi2-atk, pango, cairo, freetype, fontconfig, dbus, nss, nspr, alsaLib, cups, expat, udev, gnome3
, xorg, mozjpeg, makeWrapper, wrapGAppsHook, libuuid, at-spi2-core
}:
stdenv.mkDerivation rec {
pname = "avocode";
version = "4.10.4";
src = fetchurl {
url = "https://media.avocode.com/download/avocode-app/${version}/avocode-${version}-linux.zip";
sha256 = "06xf5y2mljk3pd74ap9n90bhhidbzpg5c6wws361ygd4f3x86c46";
};
libPath = stdenv.lib.makeLibraryPath (with xorg; [
stdenv.cc.cc.lib
at-spi2-core.out
gdk-pixbuf
glib
gtk3
atk
at-spi2-atk
pango
cairo
freetype
fontconfig
dbus
nss
nspr
alsaLib
cups
expat
udev
libX11
libxcb
libXi
libXcursor
libXdamage
libXrandr
libXcomposite
libXext
libXfixes
libXrender
libXtst
libXScrnSaver
libuuid
]);
desktopItem = makeDesktopItem {
name = "Avocode";
exec = "avocode";
icon = "avocode";
desktopName = "Avocode";
genericName = "Design Inspector";
categories = "Development;";
comment = "The bridge between designers and developers";
};
nativeBuildInputs = [makeWrapper wrapGAppsHook];
buildInputs = [ unzip gtk3 gnome3.adwaita-icon-theme ];
# src is producing multiple folder on unzip so we must
# override unpackCmd to extract it into newly created folder
unpackCmd = ''
mkdir out
unzip $curSrc -d out
'';
installPhase = ''
substituteInPlace avocode.desktop.in \
--replace /path/to/avocode-dir/Avocode $out/bin/avocode \
--replace /path/to/avocode-dir/avocode.png avocode
mkdir -p share/applications share/pixmaps
mv avocode.desktop.in share/applications/avocode.desktop
mv avocode.png share/pixmaps/
rm resources/cjpeg
cp -av . $out
mkdir $out/bin
ln -s $out/avocode $out/bin/avocode
ln -s ${mozjpeg}/bin/cjpeg $out/resources/cjpeg
'';
postFixup = ''
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/avocode
for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do
patchelf --set-rpath ${libPath}:$out/ $file || true
done
'';
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://avocode.com/";
description = "The bridge between designers and developers";
license = licenses.unfree;
platforms = platforms.linux;
maintainers = with maintainers; [ megheaiulian ];
};
}