1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 22:20:51 +00:00
nixpkgs/pkgs/tools/misc/sweep-visualizer/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

60 lines
2.2 KiB
Nix

{ stdenv, lib, makeWrapper, fetchurl,
alsaLib, atk, cairo, cups, dbus, expat, fontconfig, freetype, gdk-pixbuf, glib,
gnome2, pango, gtk2-x11, nspr, nss,
libX11, libxcb, libXcomposite, libXcursor, libXdamage, libXext, libXfixes,
libXi, libXrandr, libXrender, libXScrnSaver, libXtst,
libudev0-shim
}:
stdenv.mkDerivation rec {
pname = "sweep-visualizer";
version = "0.15.0";
src = fetchurl {
url = "https://s3.amazonaws.com/scanse/Visualizer/v${version}/sweepvisualizer_${version}_amd64.deb";
sha256 = "1k6rdjw2340qrzafv6hjxvbvyh3s1wad6d3629nchdcrpyx9xy1c";
};
nativeBuildInputs = [ makeWrapper ];
sourceRoot = ".";
unpackCmd = ''
ar p "$src" data.tar.xz | tar xJ
'';
buildPhase = ":";
installPhase = ''
mkdir -p $out/bin $out/share/sweep-visualizer
mv usr/share/* $out/share
mv opt/Sweep\ Visualizer\ BETA/* $out/share/sweep-visualizer/
ln -s $out/share/sweep-visualizer/sweep_visualizer $out/bin/sweep_visualizer
'';
preFixup = let
libPath = lib.makeLibraryPath [
alsaLib atk cairo cups.lib dbus.lib expat fontconfig.lib freetype
gdk-pixbuf glib gnome2.GConf pango gtk2-x11 nspr nss stdenv.cc.cc.lib
libX11 libxcb libXcomposite libXcursor libXdamage libXext libXfixes
libXi libXrandr libXrender libXScrnSaver libXtst
];
runtimeLibs = lib.makeLibraryPath [ libudev0-shim ];
in ''
for lib in $out/share/sweep-visualizer/*.so; do
patchelf --set-rpath "$out/share/sweep-visualizer:${libPath}" $lib
done
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$out/share/sweep-visualizer:${libPath}" \
$out/share/sweep-visualizer/sweep_visualizer
wrapProgram "$out/bin/sweep_visualizer" --prefix LD_LIBRARY_PATH : ${runtimeLibs}
'';
meta = with lib; {
homepage = "https://support.scanse.io/hc/en-us/articles/115006008948-Visualizer-Overview";
description = "A minimal desktop application for interfacing with the Sweep device";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ mt-caret ];
};
}