nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ autoPatchelfHook, makeDesktopItem, lib, stdenv, wrapGAppsHook, fetchurl, copyDesktopItems
2, alsa-lib, at-spi2-atk, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig
3, freetype, gdk-pixbuf, glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid
4, libX11, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext
5, libXfixes, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence
6, mesa, nspr, nss, pango, systemd, libappindicator-gtk3, libdbusmenu
7}:
8
9stdenv.mkDerivation rec {
10 pname = "premid";
11 version = "2.3.2";
12
13 src = fetchurl {
14 url = "https://github.com/premid/Linux/releases/download/v${version}/${pname}.tar.gz";
15 sha256 = "sha256-TuID63cVZkQ2kBl2iZeuVvjRUJYBt62ppPvgffBlOXY=";
16 };
17
18 nativeBuildInputs = [
19 autoPatchelfHook
20 wrapGAppsHook
21 copyDesktopItems
22 ];
23
24 buildInputs = [
25 alsa-lib
26 cups
27 libdrm
28 libuuid
29 libXdamage
30 libX11
31 libXScrnSaver
32 libXtst
33 libxcb
34 libxshmfence
35 mesa
36 nss
37 ];
38
39 dontWrapGApps = true;
40 dontBuild = true;
41 dontConfigure = true;
42
43 libPath = lib.makeLibraryPath [
44 libcxx systemd libpulseaudio libdrm mesa
45 stdenv.cc.cc alsa-lib atk at-spi2-atk at-spi2-core cairo cups dbus expat fontconfig freetype
46 gdk-pixbuf glib gtk3 libnotify libX11 libXcomposite libuuid
47 libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
48 libXtst nspr nss libxcb pango systemd libXScrnSaver
49 libappindicator-gtk3 libdbusmenu
50 ];
51
52 installPhase = ''
53 mkdir -p $out/{bin,opt/PreMiD,share/pixmaps}
54 mv * $out/opt/PreMiD
55
56 chmod +x $out/opt/PreMiD/${pname}
57 patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
58 $out/opt/PreMiD/${pname}
59
60 wrapProgram $out/opt/PreMiD/${pname} \
61 "''${gappsWrapperArgs[@]}" \
62 --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
63 --prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/${pname}
64
65 ln -s $out/opt/PreMiD/${pname} $out/bin/
66 '';
67
68 # This is the icon used by the desktop file
69 postInstall = ''
70 ln -s $out/opt/PreMiD/assets/appIcon.png $out/share/pixmaps/${pname}.png
71 '';
72
73 desktopItems = [
74 (makeDesktopItem {
75 name = pname;
76 exec = "PreMiD";
77 icon = pname;
78 desktopName = "PreMiD";
79 genericName = meta.description;
80 mimeTypes = [ "x-scheme-handler/premid" ];
81 })
82 ];
83
84 meta = with lib; {
85 description = "A simple, configurable utility to show your web activity as playing status on Discord";
86 homepage = "https://premid.app";
87 downloadPage = "https://premid.app/downloads";
88 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
89 license = licenses.mpl20;
90 maintainers = with maintainers; [ natto1784 ];
91 platforms = [ "x86_64-linux" ];
92 };
93}