From be4b100ae5a2e99daf5df9cc4d226842b7548777 Mon Sep 17 00:00:00 2001 From: Jos van Bakel Date: Mon, 29 Apr 2019 19:22:37 +0200 Subject: [PATCH] rsibreak: add module --- modules/misc/news.nix | 8 ++++++++ modules/modules.nix | 1 + modules/services/rsibreak.nix | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 modules/services/rsibreak.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 69299ba8..698c37ca 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1076,6 +1076,14 @@ in support to your VSCode. ''; } + + { + time = "2019-05-04T23:56:39+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.rsibreak'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index e4d35088..d7bbd8dd 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -112,6 +112,7 @@ let (loadModule ./services/polybar.nix { }) (loadModule ./services/random-background.nix { }) (loadModule ./services/redshift.nix { }) + (loadModule ./services/rsibreak.nix { condition = hostPlatform.isLinux; }) (loadModule ./services/screen-locker.nix { }) (loadModule ./services/stalonetray.nix { }) (loadModule ./services/status-notifier-watcher.nix { }) diff --git a/modules/services/rsibreak.nix b/modules/services/rsibreak.nix new file mode 100644 index 00000000..242e0343 --- /dev/null +++ b/modules/services/rsibreak.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.rsibreak; + +in + +{ + options.services.rsibreak = { + + enable = mkEnableOption "rsibreak"; + + }; + + config = mkIf cfg.enable { + systemd.user.services.rsibreak = { + Unit = { + Description = "RSI break timer"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + Environment = "PATH=${config.home.profileDirectory}/bin"; + ExecStart = "${pkgs.rsibreak}/bin/rsibreak"; + }; + }; + }; +}