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/xautolock: rewrite and add some options #30128
Conversation
ah this is the change we talked about some time ago?
I'll definetely try tondo a review in the nsxt days:)
… On 5. Oct 2017, at 4:00 PM, WilliButz ***@***.***> wrote:
Things done
xautolock is now run as a user service
added the killer and killertime options to the module
added extraOptions for additional customization
Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
Built on platform(s)
NixOS
macOS
Linux
Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
Tested execution of all binary files (usually in ./result/bin/)
Fits CONTRIBUTING.md.
/cc @Ma27 @fpletz
You can view, comment on, or merge this pull request online at:
#30128
Commit Summary
nixos/xautolock: rewrite and add some options
File Changes
M nixos/modules/services/x11/xautolock.nix (90)
Patch Links:
https://github.com/NixOS/nixpkgs/pull/30128.patch
https://github.com/NixOS/nixpkgs/pull/30128.diff
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
type = types.nullOr types.string; | ||
|
||
description = '' | ||
The script to use when manually locking the computer with `xautolock -locknow`. |
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.
I believe
`xautolock -locknow`
here should be
<command>xautolock -locknow</command>
since the description is interpreted as docbook code.
killer = mkOption { | ||
default = null; # default according to `man xautolock` is none | ||
example = "systemctl suspend"; | ||
type = types.string; |
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.
must be types.nullOr types.string
.
I left this one empty and I got error: The option value `services.xserver.xautolock.killer' in `/home/ma27/Projects/nixpkgs/nixos/modules/services/x11/xautolock.nix' is not a string.
@@ -45,28 +55,80 @@ in | |||
}; | |||
|
|||
notifier = mkOption { | |||
default = "notify-send 'Locking in 10 seconds'"; | |||
type = types.string; | |||
default = null; |
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.
as you added an assertion to ensure that notifier
contains a useful script, default = null
is not a good idea, right?
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.
Ah, I did this so that you'd have to take care of the script when you set enableNotifier
to true, because the previous default notify-send
was not mentioned in the manpage and would add another dependency.
FYI I built a simple test VM using the following expression to confirm this change: {
xautolock = { pkgs, ... }: with pkgs; {
environment.systemPackages = [ pkgs.i3lock ];
users.extraUsers.vm = {
password = "vm";
extraGroups = [ "wheel" ];
isNormalUser = true;
};
services.xserver = {
enable = true;
windowManager = {
i3.enable = true;
default = "i3";
};
desktopManager = {
xterm.enable = false;
default = "none";
};
xautolock = {
enable = true;
enableNotifier = true;
locker = "i3lock";
killer = "systemctl suspend";
notifier = "notify-send 'abc'";
};
};
};
} |
760aa18
to
5ed21ee
Compare
default = "notify-send 'Locking in 10 seconds'"; | ||
type = types.string; | ||
default = null; | ||
example = "notify-send 'Locking in 10 seconds'"; |
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.
Would this example actually work if libnotify
is not installed? Should this not be "${pkgs.libnotify}/bin/notify-send" 'Locking in 10 seconds'
.
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.
true, but the example is just for documentation purposes and nothing that actually influences the system, right?
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.
@Mic92 No it actually won't, but I'm not sure what example should be used there, so I kept the previous one. I'd prefix it as you did if this example with notify-send is acceptable, even though it does not notify me on my own system like that. I'm using i3wm and here it probably would be more fitting to use something like i3-nagbar -m 'locking soon'
.
I'm open for suggestions :)
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.
I just got it working. I need to have notify-osd
running and then notify-send
works, which means anyone using notify-send
has to enable/run the daemon manually. I think this is not for the xautolock module to handle, right?
If so, I'd just prefix the command in the example :)
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.
Using the following value should do the trick:
example = literalExample ''"${pkgs.libnotify}/bin/notify-send \"Locking in 10 seconds\"''';
@WilliButz done :-) |
@Ma27 can you formalize that in to a proper nixos test that can be run by hydra? |
@grahamc sorry for the delay, I've just seen your comment right now as I talked with @WilliButz about some user services and things like this. |
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)/cc @Ma27 @fpletz