Skip to content

services.logind: add options for lid-switch behavior #25971

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

Merged
merged 1 commit into from
May 23, 2017
Merged

services.logind: add options for lid-switch behavior #25971

merged 1 commit into from
May 23, 2017

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented May 21, 2017

Motivation for this change

Right now it's necessary to use the services.logind.extraConfig option to define the wanted lid-switch behavior. However well-defined options are better (and more predictable) than placing several params into a config option.

Things done
  • 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 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.

Sorry, something went wrong.

@mention-bot
Copy link

@Ma27, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @abbradar and @ericsagnes to be potential reviewers.

@@ -595,6 +595,25 @@ in
'';
};

services.logind.lidSwitch = mkOption {
default = "ignore";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the default of logind here.

@@ -595,6 +595,25 @@ in
'';
};

services.logind.lidSwitch = mkOption {
default = "suspend";
example = "ignore";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing type. Prefer enum, IMHO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

default = "ignore";
example = "suspend";

type = types.enum([
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe factor out the enum and re-use it here and above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Ma27
Copy link
Member Author

Ma27 commented May 22, 2017

is there anything else missing or can this be merged?

"hibernate"
"hybrid-sleep"
"lock"
]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That code and the naming looks a bit clunky IMHO.

What about:

logindHandlerType = types.enum [
  "ignore" "poweroff" "reboot" "halt" "kexec" "suspend"
  "hibernate" "hybrid-sleep" "lock"
];

@fpletz
Copy link
Member

fpletz commented May 22, 2017

Oh, and please squash your commits. That way we don't have to rebase/squash and remove your PGP signature in the process. :)

@Ma27
Copy link
Member Author

Ma27 commented May 23, 2017

@fpletz done :-)

@Ma27
Copy link
Member Author

Ma27 commented May 23, 2017 via email

@Ma27
Copy link
Member Author

Ma27 commented May 23, 2017

@fpletz I rebased onto the latest master (which seems to pass), so the build should get green now :-)

@fpletz
Copy link
Member

fpletz commented May 23, 2017

Awesome, thanks!

@fpletz fpletz merged commit 2d12d2b into NixOS:master May 23, 2017
@Ma27 Ma27 deleted the systemd/logind-config branch May 24, 2017 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants