New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/xsslock: add module #40619
nixos/xsslock: add module #40619
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module looks fine but the test should use a different approach.
nixos/tests/xss-lock.nix
Outdated
|
||
$machine->fail("pgrep xlock"); | ||
$machine->systemctl("suspend"); | ||
$machine->sendKeys("a"); # wakeup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suspending the VM is quite fragile and non-deterministic. This test only works if the VM does not go fully into suspend yet by the time the keypress event arrives. Try sleep 5
in the perl script (not the VM) after the systemctl("suspend")
: once the VM is really suspended, it doesn't come back, and the test is stuck.
As an alternative, try to activate xsslock using DPMS: $machine->succeed("xset dpms force standby");
instead of suspend and sendKeys. This will also activate the screen locker and should give you a reliable test.
`xsslock` (which was originally packaged in 6cb1d1a) is a simple screensaver which connects a given screen locker (e.g. `i3lock`) with `logind`. Whenever `loginctl lock-sessions` is invoked the locker will be used to lock the screen. This works with its power management features (e.g. `lid switch`) as well, so the PC can be locked automatically when the lid is closed. The module can be used like this: ``` { services.xserver.enable = true; programs.xss-lock.enable = true; programs.xss-lock.lockerCommand = "i3lock"; } ```
you're right, |
@xeji I'm very sorry for this, it seems as the test fails on Hydra: https://hydra.nixos.org/build/74427415 |
I cannot reproduce the error locally even under high load but the sequence of logged events is pretty much the same as on hydra. I guess it's a timing problem: xlock activation is delayed a little. |
Please refer to the conversation in the original PR (NixOS#40619) for further reference: NixOS#40619 (comment) It takes some time after the standby to trigger the locker which might break the test on Hydra.
Please refer to the conversation in the original PR (#40619) for further reference: #40619 (comment) It takes some time after the standby to trigger the locker which might break the test on Hydra.
`xsslock` (which was originally packaged in 6cb1d1a) is a simple screensaver which connects a given screen locker (e.g. `i3lock`) with `logind`. Whenever `loginctl lock-sessions` is invoked the locker will be used to lock the screen. This works with its power management features (e.g. `lid switch`) as well, so the PC can be locked automatically when the lid is closed. The module can be used like this: ``` { services.xserver.enable = true; programs.xss-lock.enable = true; programs.xss-lock.lockerCommand = "i3lock"; } ``` (cherry picked from commit 641a623)
Shouldn't this be under |
Motivation for this change
xsslock
(which was originally packaged in 6cb1d1a)is a simple screensaver which connects a given screen locker (e.g.
i3lock
) withlogind
. Wheneverloginctl lock-sessions
is invokedthe locker will be used to lock the screen. This works with its power
management features (e.g.
lid switch
) as well, so the PC can be lockedautomatically when the lid is closed.
The module can be used like this:
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)