depot/third_party/nixpkgs/nixos/modules/services/x11/xscreensaver.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

40 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.services.xscreensaver;
in
{
options.services.xscreensaver = {
enable = lib.mkEnableOption "xscreensaver user service";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.xscreensaver;
defaultText = lib.literalExpression "pkgs.xscreensaver";
description = "Which xscreensaver package to use.";
};
};
config = lib.mkIf cfg.enable {
# Make xscreensaver-auth setuid root so that it can (try to) prevent the OOM
# killer from unlocking the screen.
security.wrappers.xscreensaver-auth = {
setuid = true;
owner = "root";
group = "root";
source = "${pkgs.xscreensaver}/libexec/xscreensaver/xscreensaver-auth";
};
systemd.user.services.xscreensaver = {
enable = true;
description = "XScreenSaver";
after = [ "graphical-session-pre.target" ];
partOf = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
path = [ cfg.package ];
serviceConfig.ExecStart = "${cfg.package}/bin/xscreensaver -no-splash";
};
};
meta.maintainers = with lib.maintainers; [ vancluever AndersonTorres ];
}