nixpkgs/nixos/modules/programs/xss-lock.nix
NAHO a2ed7e8d88
nixos: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --exclude doc/manual/release-notes \
      --type file \
      . \
      nixos \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2026-01-15 16:07:55 +01:00

53 lines
1.3 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.xss-lock;
in
{
options.programs.xss-lock = {
enable = lib.mkEnableOption "xss-lock";
lockerCommand = lib.mkOption {
default = "${pkgs.i3lock}/bin/i3lock";
defaultText = lib.literalExpression ''"''${pkgs.i3lock}/bin/i3lock"'';
example = lib.literalExpression ''"''${pkgs.i3lock-fancy}/bin/i3lock-fancy"'';
type = lib.types.separatedString " ";
description = "Locker to be used with xsslock";
};
extraOptions = lib.mkOption {
default = [ ];
example = [ "--ignore-sleep" ];
type = lib.types.listOf lib.types.str;
description = ''
Additional command-line arguments to pass to
{command}`xss-lock`.
'';
};
};
config = lib.mkIf cfg.enable {
systemd.user.services.xss-lock = {
description = "XSS Lock Daemon";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
serviceConfig.ExecStart = builtins.concatStringsSep " " (
[
"${pkgs.xss-lock}/bin/xss-lock"
"--session \${XDG_SESSION_ID}"
]
++ (map lib.escapeShellArg cfg.extraOptions)
++ [
"--"
cfg.lockerCommand
]
);
serviceConfig.Restart = "always";
};
};
}