fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Josh Robson Chasescreen-locker: Make xautolock optional, reorganize options (#2343)e4df31dc

master
1.1 KiB36 linesraw
1{ config, pkgs, options, lib, ... }:
2
3{
4  config = {
5    services.screen-locker = {
6      enable = true;
7      inactiveInterval = 5;
8      lockCmd = "${pkgs.i3lock}/bin/i3lock -n -c AA0000";
9      xssLockExtraOptions = [ "-test" ];
10      xautolockExtraOptions = [ "-test" ];
11      enableDetectSleep = true;
12    };
13
14    test.stubs.i3lock = { };
15    test.stubs.xss-lock = { };
16
17    # Use the same verification script as the basic configuration. The result
18    # with the old options should be identical.
19    nmt.script = (import ./basic-configuration.nix {
20      inherit config pkgs;
21    }).config.nmt.script;
22
23    test.asserts.warnings.expected = with lib;
24      let
25        renamed = {
26          xssLockExtraOptions = "xss-lock.extraOptions";
27          xautolockExtraOptions = "xautolock.extraOptions";
28          enableDetectSleep = "xautolock.detectSleep";
29        };
30      in mapAttrsToList (old: new:
31        builtins.replaceStrings [ "\n" ] [ " " ] ''
32          The option `services.screen-locker.${old}' defined in
33          ${showFiles options.services.screen-locker.${old}.files}
34          has been renamed to `services.screen-locker.${new}'.'') renamed;
35  };
36}