From e00f9b316b2f9e1b1d5ed1a33fc97a0058bd5ae6 Mon Sep 17 00:00:00 2001 From: BjornMelgaard Date: Sat, 24 Mar 2018 19:15:31 +0200 Subject: [PATCH 1/8] safeeyes: init at 2.0.2 --- pkgs/applications/misc/safeeyes/default.nix | 57 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 59 insertions(+) create mode 100644 pkgs/applications/misc/safeeyes/default.nix diff --git a/pkgs/applications/misc/safeeyes/default.nix b/pkgs/applications/misc/safeeyes/default.nix new file mode 100644 index 000000000000..0f60916891ca --- /dev/null +++ b/pkgs/applications/misc/safeeyes/default.nix @@ -0,0 +1,57 @@ +{ lib, python3Packages, gobjectIntrospection, libappindicator-gtk3, gtk3, gnome3, xprintidle-ng +}: + +let inherit (python3Packages) python buildPythonApplication fetchPypi; + +in buildPythonApplication rec { + name = "${pname}-${version}"; + pname = "safeeyes"; + version = "2.0.2"; + namePrefix = ""; + + src = fetchPypi { + inherit pname version; + sha256 = "1fx6zd4hnbc7gdpac6r7smxwdl1bifaxx3mnx0wrqfvhpnwr1ybv"; + }; + + buildInputs = [ gtk3 gobjectIntrospection gnome3.defaultIconTheme ]; + + propagatedBuildInputs = with python3Packages; [ + Babel + psutil + xlib + pygobject3 + dbus-python + + libappindicator-gtk3 + xprintidle-ng + ]; + + # patch smartpause plugin + postPatch = '' + sed -i \ + -e 's!xprintidle!${xprintidle-ng}/bin/xprintidle-ng!g' \ + safeeyes/plugins/smartpause/plugin.py + + sed -i \ + -e 's!xprintidle!${xprintidle-ng}/bin/xprintidle-ng!g' \ + safeeyes/plugins/smartpause/config.json + ''; + + doCheck = false; + + makeWrapperArgs = [ + "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" + "--set GDK_PIXBUF_MODULE_FILE \"$GDK_PIXBUF_MODULE_FILE\"" + "--prefix XDG_DATA_DIRS : \"$out/lib/${python.libPrefix}/site-packages/usr/share\"" + "--suffix XDG_DATA_DIRS : \"$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\"" + ]; + + meta = { + 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 = [ ]; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9bc5658f7f40..5a2f6cadc096 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4723,6 +4723,8 @@ with pkgs; safe-rm = callPackage ../tools/system/safe-rm { }; + safeeyes = callPackage ../applications/misc/safeeyes { }; + salt = callPackage ../tools/admin/salt {}; salut_a_toi = callPackage ../applications/networking/instant-messengers/salut-a-toi {}; From 3bbe655c440034ffe925cd99f6ae6dd1ec36f5f8 Mon Sep 17 00:00:00 2001 From: BjornMelgaard Date: Sun, 1 Apr 2018 12:43:28 +0300 Subject: [PATCH 2/8] maintainers: add myself --- maintainers/maintainer-list.nix | 5 +++++ pkgs/applications/misc/safeeyes/default.nix | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 3953856b2f1d..77c648c39dc4 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -4130,4 +4130,9 @@ github = "zzamboni"; name = "Diego Zamboni"; }; + srghma = { + email = "srghma@gmail.com"; + github = "srghma"; + name = "Sergei Khoma"; + }; } diff --git a/pkgs/applications/misc/safeeyes/default.nix b/pkgs/applications/misc/safeeyes/default.nix index 0f60916891ca..5b6599b45ddd 100644 --- a/pkgs/applications/misc/safeeyes/default.nix +++ b/pkgs/applications/misc/safeeyes/default.nix @@ -51,7 +51,7 @@ in buildPythonApplication rec { 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 = [ ]; + maintainers = with lib.maintainers; [ srghma ]; platforms = lib.platforms.all; }; } From 2f4a220130951312c939c3bf20e80bcee16aee28 Mon Sep 17 00:00:00 2001 From: BjornMelgaard Date: Wed, 4 Apr 2018 23:15:16 +0300 Subject: [PATCH 3/8] safeeyes: add module --- nixos/modules/module-list.nix | 1 + nixos/modules/services/misc/safeeyes.nix | 48 +++++++++++++++++++++ pkgs/applications/misc/safeeyes/default.nix | 4 +- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 nixos/modules/services/misc/safeeyes.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 63e463370d1f..3a9a2bf86616 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -366,6 +366,7 @@ ./services/misc/ripple-data-api.nix ./services/misc/rogue.nix ./services/misc/serviio.nix + ./services/misc/safeeyes.nix ./services/misc/siproxd.nix ./services/misc/snapper.nix ./services/misc/sonarr.nix diff --git a/nixos/modules/services/misc/safeeyes.nix b/nixos/modules/services/misc/safeeyes.nix new file mode 100644 index 000000000000..a1d304d290fd --- /dev/null +++ b/nixos/modules/services/misc/safeeyes.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.safeeyes; + +in + +{ + + ###### interface + + options = { + + services.safeeyes = { + + enable = mkOption { + default = false; + description = "Whether to enable the safeeyes OSGi service"; + }; + + }; + + }; + + ###### implementation + + config = mkIf cfg.enable { + + systemd.user.services.safeeyes = { + description = "Safeeyes"; + + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + + serviceConfig = { + ExecStart = '' + ${pkgs.safeeyes}/bin/safeeyes + ''; + RestartSec = 3; + Restart = "always"; + }; + }; + + }; +} diff --git a/pkgs/applications/misc/safeeyes/default.nix b/pkgs/applications/misc/safeeyes/default.nix index 5b6599b45ddd..e2623bffe0c5 100644 --- a/pkgs/applications/misc/safeeyes/default.nix +++ b/pkgs/applications/misc/safeeyes/default.nix @@ -30,11 +30,11 @@ in buildPythonApplication rec { # patch smartpause plugin postPatch = '' sed -i \ - -e 's!xprintidle!${xprintidle-ng}/bin/xprintidle-ng!g' \ + -e 's!xprintidle!xprintidle-ng!g' \ safeeyes/plugins/smartpause/plugin.py sed -i \ - -e 's!xprintidle!${xprintidle-ng}/bin/xprintidle-ng!g' \ + -e 's!xprintidle!xprintidle-ng!g' \ safeeyes/plugins/smartpause/config.json ''; From def5645ba170f75a5d205df2440af010570f7c82 Mon Sep 17 00:00:00 2001 From: BjornMelgaard Date: Wed, 4 Apr 2018 23:15:49 +0300 Subject: [PATCH 4/8] all-packages: fix identation --- pkgs/top-level/all-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5a2f6cadc096..0a6b87dc2eda 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -629,9 +629,9 @@ with pkgs; encryptr = callPackage ../tools/security/encryptr { gconf = gnome2.GConf; - }; + }; - enchive = callPackage ../tools/security/enchive { }; + enchive = callPackage ../tools/security/enchive { }; enpass = callPackage ../tools/security/enpass { }; From 46c270c5a6f9d10c77502b0824cfa42eff6f61c3 Mon Sep 17 00:00:00 2001 From: BjornMelgaard Date: Tue, 10 Apr 2018 21:06:38 +0300 Subject: [PATCH 5/8] safeeyes: restart only on failure --- nixos/modules/services/misc/safeeyes.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/safeeyes.nix b/nixos/modules/services/misc/safeeyes.nix index a1d304d290fd..1a33971d9227 100644 --- a/nixos/modules/services/misc/safeeyes.nix +++ b/nixos/modules/services/misc/safeeyes.nix @@ -39,8 +39,10 @@ in ExecStart = '' ${pkgs.safeeyes}/bin/safeeyes ''; + Restart = "on-failure"; RestartSec = 3; - Restart = "always"; + StartLimitInterval = 350; + StartLimitBurst = 10; }; }; From 35cbab94bc1a871e64e13cbc87db3af8d9721548 Mon Sep 17 00:00:00 2001 From: BjornMelgaard Date: Tue, 10 Apr 2018 21:42:50 +0300 Subject: [PATCH 6/8] safeeyes: change quotes --- pkgs/applications/misc/safeeyes/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/misc/safeeyes/default.nix b/pkgs/applications/misc/safeeyes/default.nix index e2623bffe0c5..dcfd34152942 100644 --- a/pkgs/applications/misc/safeeyes/default.nix +++ b/pkgs/applications/misc/safeeyes/default.nix @@ -41,10 +41,10 @@ in buildPythonApplication rec { doCheck = false; makeWrapperArgs = [ - "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" - "--set GDK_PIXBUF_MODULE_FILE \"$GDK_PIXBUF_MODULE_FILE\"" - "--prefix XDG_DATA_DIRS : \"$out/lib/${python.libPrefix}/site-packages/usr/share\"" - "--suffix XDG_DATA_DIRS : \"$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\"" + ''--set GI_TYPELIB_PATH "$GI_TYPELIB_PATH"'' + ''--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"'' + ''--suffix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH"'' + ''--prefix XDG_DATA_DIRS : "$out/lib/${python.libPrefix}/site-packages/usr/share"'' ]; meta = { From f319b16ab35dc7429673eee2d04837fdb95dd284 Mon Sep 17 00:00:00 2001 From: BjornMelgaard Date: Tue, 10 Apr 2018 21:57:24 +0300 Subject: [PATCH 7/8] safeeyes: add libnotify to deps --- pkgs/applications/misc/safeeyes/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/misc/safeeyes/default.nix b/pkgs/applications/misc/safeeyes/default.nix index dcfd34152942..984992f06891 100644 --- a/pkgs/applications/misc/safeeyes/default.nix +++ b/pkgs/applications/misc/safeeyes/default.nix @@ -1,4 +1,4 @@ -{ lib, python3Packages, gobjectIntrospection, libappindicator-gtk3, gtk3, gnome3, xprintidle-ng +{ lib, python3Packages, gobjectIntrospection, libappindicator-gtk3, libnotify, gtk3, gnome3, xprintidle-ng }: let inherit (python3Packages) python buildPythonApplication fetchPypi; @@ -24,6 +24,7 @@ in buildPythonApplication rec { dbus-python libappindicator-gtk3 + libnotify xprintidle-ng ]; From 344c142cda39a467f6d8f398ae9c47d68a426936 Mon Sep 17 00:00:00 2001 From: BjornMelgaard Date: Tue, 10 Apr 2018 22:22:33 +0300 Subject: [PATCH 8/8] safeeyes: use wrapGAppsHook --- pkgs/applications/misc/safeeyes/default.nix | 31 +++++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/misc/safeeyes/default.nix b/pkgs/applications/misc/safeeyes/default.nix index 984992f06891..7c3bda8c06de 100644 --- a/pkgs/applications/misc/safeeyes/default.nix +++ b/pkgs/applications/misc/safeeyes/default.nix @@ -1,4 +1,4 @@ -{ lib, python3Packages, gobjectIntrospection, libappindicator-gtk3, libnotify, gtk3, gnome3, xprintidle-ng +{ lib, python3Packages, gobjectIntrospection, libappindicator-gtk3, libnotify, gtk3, gnome3, xprintidle-ng, wrapGAppsHook, gdk_pixbuf, shared-mime-info, librsvg }: let inherit (python3Packages) python buildPythonApplication fetchPypi; @@ -14,7 +14,16 @@ in buildPythonApplication rec { sha256 = "1fx6zd4hnbc7gdpac6r7smxwdl1bifaxx3mnx0wrqfvhpnwr1ybv"; }; - buildInputs = [ gtk3 gobjectIntrospection gnome3.defaultIconTheme ]; + buildInputs = [ + gtk3 + gobjectIntrospection + gnome3.defaultIconTheme + gnome3.adwaita-icon-theme + ]; + + nativeBuildInputs = [ + wrapGAppsHook + ]; propagatedBuildInputs = with python3Packages; [ Babel @@ -39,14 +48,18 @@ in buildPythonApplication rec { safeeyes/plugins/smartpause/config.json ''; - doCheck = false; + preFixup = '' + gappsWrapperArgs+=( + --prefix XDG_DATA_DIRS : "${gdk_pixbuf}/share" + --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" + --prefix XDG_DATA_DIRS : "${librsvg}/share" - makeWrapperArgs = [ - ''--set GI_TYPELIB_PATH "$GI_TYPELIB_PATH"'' - ''--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"'' - ''--suffix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH"'' - ''--prefix XDG_DATA_DIRS : "$out/lib/${python.libPrefix}/site-packages/usr/share"'' - ]; + # safeeyes images + --prefix XDG_DATA_DIRS : "$out/lib/${python.libPrefix}/site-packages/usr/share" + ) + ''; + + doCheck = false; # no tests meta = { homepage = http://slgobinath.github.io/SafeEyes;