2017-01-07 18:16:26 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2019-04-22 20:42:42 +00:00
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.xscreensaver;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
{
|
2017-09-26 21:40:31 +00:00
|
|
|
meta.maintainers = [ maintainers.rycee ];
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
options = {
|
|
|
|
services.xscreensaver = {
|
|
|
|
enable = mkEnableOption "XScreenSaver";
|
2019-04-22 20:42:42 +00:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = with types; attrsOf (either bool (either int str));
|
|
|
|
default = {};
|
|
|
|
example = {
|
|
|
|
mode = "blank";
|
|
|
|
lock = false;
|
|
|
|
fadeTicks = 20;
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
The settings to use for XScreenSaver.
|
|
|
|
'';
|
|
|
|
};
|
2017-01-07 18:16:26 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-04-22 20:42:42 +00:00
|
|
|
config = mkIf cfg.enable {
|
2018-03-01 22:21:45 +00:00
|
|
|
# To make the xscreensaver-command tool available.
|
|
|
|
home.packages = [ pkgs.xscreensaver ];
|
|
|
|
|
2019-04-22 20:42:42 +00:00
|
|
|
xresources.properties =
|
|
|
|
mapAttrs' (n: nameValuePair "xscreensaver.${n}") cfg.settings;
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
systemd.user.services.xscreensaver = {
|
|
|
|
Unit = {
|
|
|
|
Description = "XScreenSaver";
|
2017-06-26 16:34:09 +00:00
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
2017-01-07 18:16:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
ExecStart = "${pkgs.xscreensaver}/bin/xscreensaver -no-splash";
|
|
|
|
};
|
|
|
|
|
|
|
|
Install = {
|
2017-01-09 21:45:42 +00:00
|
|
|
WantedBy = [ "graphical-session.target" ];
|
2017-01-07 18:16:26 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|