From 44916a6f49d88e79e9e0b29fc26ae5fe75cc9510 Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Fri, 15 Jul 2022 18:15:11 +0200 Subject: [PATCH] caffeine-ng: 3.5.1 -> 4.0.2 --- pkgs/tools/X11/caffeine-ng/default.nix | 86 ++++++++++++++++++-------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/pkgs/tools/X11/caffeine-ng/default.nix b/pkgs/tools/X11/caffeine-ng/default.nix index 85f196b460ea..ea8e5b389e48 100644 --- a/pkgs/tools/X11/caffeine-ng/default.nix +++ b/pkgs/tools/X11/caffeine-ng/default.nix @@ -1,53 +1,85 @@ -{ gdk-pixbuf, glib, gobject-introspection, gtk3, lib, libnotify, - procps, xset, xautolock, xscreensaver, python3Packages, wrapGAppsHook +{ buildPythonApplication +, fetchPypi +, gobject-introspection +, gtk3 +, lib +, libappindicator-gtk3 +, libnotify +, click +, dbus-python +, ewmh +, pulsectl +, pygobject3 +, pyxdg +, setproctitle +, python3 +, procps +, xset +, xautolock +, xscreensaver +, xfce +, glib +, setuptools-scm +, wrapGAppsHook }: -python3Packages.buildPythonApplication rec { +let + click_7 = click.overridePythonAttrs (old: rec { + version = "7.1.2"; + src = old.src.override { + inherit version; + sha256 = "d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"; + }; + }); +in buildPythonApplication rec { pname = "caffeine-ng"; - version = "3.5.1"; + version = "4.0.2"; - src = python3Packages.fetchPypi{ + src = fetchPypi { inherit pname version; - sha256="0akzldqvxnqngpj1s6y2phgj7ch8wfm02j6z2drqvsbvaadw0jbm"; + sha256 = "sha256-umIjXJ0et6Pi5Ejj96Q+ZhiKS+yj7bsgb4uQW6Ym6rU="; }; - nativeBuildInputs = [ wrapGAppsHook glib ]; + nativeBuildInputs = [ wrapGAppsHook glib setuptools-scm ]; + buildInputs = [ - gdk-pixbuf gobject-introspection libnotify gtk3 - python3Packages.setuptools-scm + libappindicator-gtk3 + libnotify + gobject-introspection + gtk3 ]; - pythonPath = with python3Packages; [ - dbus-python docopt ewmh pygobject3 pyxdg - setproctitle pulsectl + + pythonPath = [ + click_7 + dbus-python + ewmh + pulsectl + pygobject3 + pyxdg + setproctitle ]; doCheck = false; # There are no tests. - postPatch = '' - substituteInPlace caffeine/inhibitors.py \ - --replace 'os.system("xset' 'os.system("${xset}/bin/xset' \ - --replace 'os.system("xautolock' 'os.system("${xautolock}/bin/xautolock' \ - --replace 'os.system("pgrep' 'os.system("${procps}/bin/pgrep' \ - --replace 'os.system("xscreensaver-command' 'os.system("${xscreensaver}/bin/xscreensaver-command' - ''; - postInstall = '' - mkdir -p $out/share cp -r share $out/ - cp -r caffeine/assets/icons $out/share/icons + cp -r caffeine/assets/icons $out/share/ + # autostart file - cp -r $out/lib/python*/site-packages/etc $out/etc/ + ln -s $out/${python3.sitePackages}/etc $out/etc + glib-compile-schemas --strict $out/share/glib-2.0/schemas - for i in $(find $out -name "*.desktop"); do - substituteInPlace $i --replace /usr $out - done + + gappsWrapperArgs+=( + --prefix PATH : ${lib.makeBinPath [ procps xautolock xscreensaver xfce.xfconf xset ]} + ) ''; meta = with lib; { mainProgram = "caffeine"; maintainers = with maintainers; [ marzipankaiser ]; description = "Status bar application to temporarily inhibit screensaver and sleep mode"; - homepage = "https://github.com/caffeine-ng/caffeine-ng"; + homepage = "https://codeberg.org/WhyNotHugo/caffeine-ng"; license = licenses.gpl3; platforms = platforms.linux; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 802cb1ccf30b..9a6997f46d9b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34074,7 +34074,7 @@ with pkgs; caffeWithCuda = caffe.override { cudaSupport = true; }; - caffeine-ng = callPackage ../tools/X11/caffeine-ng {}; + caffeine-ng = python3Packages.callPackage ../tools/X11/caffeine-ng {}; cntk = callPackage ../applications/science/math/cntk { stdenv = gcc7Stdenv;