1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-24 03:59:46 +01:00
home-manager/modules/services/xscreensaver.nix

53 lines
1.1 KiB
Nix
Raw Normal View History

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