From 9b91709899ddf20cbead93e4af622bd0a501dd0b Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Sun, 25 Sep 2022 15:47:53 -0400 Subject: [PATCH] safeeyes: add module This adds a basic module for Safe Eyes based off of the one in Nixpkgs. --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 +++++++ modules/modules.nix | 1 + modules/services/safeeyes.nix | 44 +++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 modules/services/safeeyes.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 57b502368..15fbe8e49 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -448,6 +448,8 @@ Makefile @thiagokokada /modules/services/redshift-gammastep @rycee @petabyteboy @thiagokokada /tests/modules/redshift-gammastep @thiagokokada +/modules/services/safeeyes @Rosuavio + /modules/services/screen-locker.nix @jrobsonchase @rszamszur /tests/modules/services/screen-locker @jrobsonchase @rszamszur diff --git a/modules/misc/news.nix b/modules/misc/news.nix index b22d76596..34729e852 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -704,6 +704,14 @@ in A new module is available: 'xsession.windowManager.fluxbox'. ''; } + + { + time = "2022-09-25T21:00:05+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.safeeyes'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 5b01c9ea3..08c0e5d84 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -256,6 +256,7 @@ let ./services/redshift-gammastep/gammastep.nix ./services/redshift-gammastep/redshift.nix ./services/rsibreak.nix + ./services/safeeyes.nix ./services/screen-locker.nix ./services/sctd.nix ./services/spotifyd.nix diff --git a/modules/services/safeeyes.nix b/modules/services/safeeyes.nix new file mode 100644 index 000000000..156624691 --- /dev/null +++ b/modules/services/safeeyes.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.safeeyes; + +in { + meta.maintainers = [ hm.maintainers.rosuavio ]; + + options = { + services.safeeyes = { + enable = mkEnableOption "The Safe Eyes OSGI service"; + + package = mkPackageOption pkgs "safeeyes" { }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "services.safeeyes" pkgs platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + systemd.user.services.safeeyes = { + Install.WantedBy = [ "graphical-session.target" ]; + + Unit = { + Description = "Safe Eyes"; + PartOf = [ "graphical-session.target" ]; + StartLimitIntervalSec = 350; + StartLimitBurst = 30; + }; + + Service = { + ExecStart = getExe pkgs.safeeyes; + Restart = "on-failure"; + RestartSec = 3; + }; + }; + }; +}