From f411f4ae7a034e654b603c16c25ec10c33869af5 Mon Sep 17 00:00:00 2001 From: linsui Date: Sun, 14 Aug 2022 09:31:09 +0800 Subject: [PATCH] safeeyes: fix double wrap --- nixos/modules/services/misc/safeeyes.nix | 2 - pkgs/applications/misc/safeeyes/default.nix | 78 ++++++++++----------- pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/python-packages.nix | 2 + 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/nixos/modules/services/misc/safeeyes.nix b/nixos/modules/services/misc/safeeyes.nix index 638218d8bb00..38970fd77527 100644 --- a/nixos/modules/services/misc/safeeyes.nix +++ b/nixos/modules/services/misc/safeeyes.nix @@ -34,8 +34,6 @@ in wantedBy = [ "graphical-session.target" ]; partOf = [ "graphical-session.target" ]; - path = [ pkgs.alsa-utils ]; - startLimitIntervalSec = 350; startLimitBurst = 10; serviceConfig = { diff --git a/pkgs/applications/misc/safeeyes/default.nix b/pkgs/applications/misc/safeeyes/default.nix index 4a063eb8eddb..3740946db85d 100644 --- a/pkgs/applications/misc/safeeyes/default.nix +++ b/pkgs/applications/misc/safeeyes/default.nix @@ -1,74 +1,74 @@ -{ lib, python3Packages, gobject-introspection, libappindicator-gtk3, libnotify, gtk3, gnome, xprintidle-ng, wrapGAppsHook, gdk-pixbuf, shared-mime-info, librsvg +{ lib +, buildPythonApplication +, fetchPypi +, alsa-utils +, gobject-introspection +, libappindicator-gtk3 +, libnotify +, wlrctl +, gtk3 +, xprintidle +, wrapGAppsHook +, babel +, psutil +, xlib +, pygobject3 +, dbus-python +, croniter }: -let inherit (python3Packages) python buildPythonApplication fetchPypi croniter; - -in buildPythonApplication rec { +buildPythonApplication rec { pname = "safeeyes"; version = "2.1.3"; - namePrefix = ""; src = fetchPypi { inherit pname version; sha256 = "1b5w887hivmdrkm1ydbar4nmnks6grpbbpvxgf9j9s46msj03c9x"; }; - buildInputs = [ - gtk3 - gobject-introspection - gnome.adwaita-icon-theme - gnome.adwaita-icon-theme - ]; - nativeBuildInputs = [ wrapGAppsHook + gobject-introspection ]; - propagatedBuildInputs = with python3Packages; [ + buildInputs = [ + gtk3 + libappindicator-gtk3 + libnotify + ]; + + propagatedBuildInputs = [ babel psutil xlib pygobject3 dbus-python croniter - - libappindicator-gtk3 - libnotify - xprintidle-ng ]; - # patch smartpause plugin - postPatch = '' - sed -i \ - -e 's!xprintidle!xprintidle-ng!g' \ - safeeyes/plugins/smartpause/plugin.py + # Prevent double wrapping, let the Python wrapper use the args in preFixup. + dontWrapGApps = true; - sed -i \ - -e 's!xprintidle!xprintidle-ng!g' \ - safeeyes/plugins/smartpause/config.json + postInstall = '' + mkdir -p $out/share/applications + cp -r safeeyes/platform/icons $out/share/icons/ + cp safeeyes/platform/safeeyes.desktop $out/share/applications/safeeyes.desktop ''; preFixup = '' - gappsWrapperArgs+=( - --prefix XDG_DATA_DIRS : "${gdk-pixbuf}/share" - --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" - --prefix XDG_DATA_DIRS : "${librsvg}/share" - - # safeeyes images - --prefix XDG_DATA_DIRS : "$out/lib/${python.libPrefix}/site-packages/usr/share" + makeWrapperArgs+=( + "''${gappsWrapperArgs[@]}" + --prefix PATH : ${lib.makeBinPath [ alsa-utils wlrctl xprintidle ]} ) - mkdir -p $out/share/applications - cp -r safeeyes/platform/icons $out/share/ - cp safeeyes/platform/safeeyes.desktop $out/share/applications/ ''; doCheck = false; # no tests - meta = { + meta = with lib; { homepage = "http://slgobinath.github.io/SafeEyes"; description = "Protect your eyes from eye strain using this simple and beautiful, yet extensible break reminder. A Free and Open Source Linux alternative to EyeLeo"; - license = lib.licenses.gpl3; - maintainers = with lib.maintainers; [ srghma ]; - platforms = lib.platforms.all; + license = licenses.gpl3; + maintainers = with maintainers; [ srghma ]; + platforms = platforms.linux; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d0bb337c74ce..f6f328bf5e00 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10501,7 +10501,7 @@ with pkgs; safe-rm = callPackage ../tools/system/safe-rm { }; - safeeyes = callPackage ../applications/misc/safeeyes { }; + safeeyes = with python3.pkgs; toPythonApplication safeeyes; sahel-fonts = callPackage ../data/fonts/sahel-fonts { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c4fe8d82f8f6..8479bbd758ed 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9608,6 +9608,8 @@ in { safe = callPackage ../development/python-modules/safe { }; + safeeyes = callPackage ../applications/misc/safeeyes { }; + safeio = callPackage ../development/python-modules/safeio { }; safety = callPackage ../development/python-modules/safety { };