If you're comfortable having it suid, you could set security.suidPrograms =
[ "xautolock" ]; in configuration.nix. Then if xautolock is installed
globally it will hopefully work without sudo.

On 8 February 2015 at 10:07, Nikita Karetnikov <[email protected]>
wrote:

> How do I automatically lock the screen in NixOS?  I've installed
> xautolock and slock.  And tested
>
>   sudo xautolock -time 1 -locker slock
>
> in the shell, which works fine.  Can I make it work without sudo?
>
> It's a problem because these lines in configuration.nix:
>
>     displayManager.sessionCommands =
>       ''
>       sudo xautolock -time 1 -locker slock &
>       '';
>
> result in
>
>   sudo: no tty present and no askpass program specified
>
> So it fails to start.
>
> _______________________________________________
> nix-dev mailing list
> [email protected]
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to