-
-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
auto-epp: init at 1.2.1 #261378
auto-epp: init at 1.2.1 #261378
Conversation
872b65b
to
f6a3ae1
Compare
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.
You'll have to split up your changes into three commits:
maintainers: add lamarios
auto-epp: init at 1.2.1
nixos/auto-epp: init
I'm not entirely convinced that the packaging is correct, but I'll leave that to other reviewers who might know better than me.
let | ||
|
||
cfg = config.services.auto-epp; | ||
package = pkgs.auto-epp; |
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.
Consider making this an mkPackageOption
|
||
systemd.services.auto-epp = { | ||
enable = true; | ||
after = [ "network.target" "network-online.target" ]; |
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.
Does this service really need networking in order to work?
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.
most likely not, i was following upstream. Will change accordingly.
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.
Cool. Maybe we should notify upstream
description = "auto-epp - Automatic EPP Changer for amd-pstate-epp"; | ||
serviceConfig = { | ||
Type = "simple"; | ||
User = "root"; |
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.
Does this service need to run as root? Maybe we could make it DynamicUser
and give it the permissions it needs through CapabilityBoundingSet
?
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'll need to research on this as i have no idea on how those work.
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.
After some check, it requires to run as root, logs from journalctl:
Oct 17 12:02:01 yoga7 auto-epp[53340]: auto-epp must be run with root privileges.
see upstream
@@ -0,0 +1,59 @@ | |||
{ config, lib, pkgs, ... }: | |||
with lib; |
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.
There are ongoing efforts to avoid with lib;
statements. I won't block the PR on this, but would you mind changing it out for an inherit (lib) ...;
for the most commonly used items, and just prepending lib.
to everything that's only used once or twice?
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.
ok, all addressed except commit splitting, let's see if it's good to go first then i'll split
fff1c60
to
de72325
Compare
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.
Okay, just a few more comments
''; | ||
|
||
meta = with lib; { | ||
mainProgram = pname; |
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.
nit: while i understand the intent here, it's semantically wrong. The executable doesn't necessarily have the same name as the package - it just happens to be the case here (and for many other packages as well).
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.
sure, i'll create a variable for it
@@ -0,0 +1,31 @@ | |||
{ lib, stdenv, fetchFromGitHub, python3 }: |
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 you be willing to move your package to the new by-name
set by the way? AFAIK it's not obligatory just yet, but many new packages are shifting towards using this.
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.
sure, any docs or example i can read ?
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.
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.
if i understand properly, i just need to move my default.nix file to pkgs/by-name/au/auto-epp/package.nix and remove it from the top-level/all-packages.nix ?
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.
Yes, I think so
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.
ok, done
systemd.packages = [ cfg.package ]; | ||
|
||
systemd.services.auto-epp = lib.mkIf cfg.enable { | ||
enable = true; |
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.
This is redundant, I think: https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/systemd-unit-options.nix#L37-L38
This is looking pretty good. You'll have to rebase your commits into
But apart from that, this is ready to merge as far as I'm concerned |
0afbf62
to
eeb99ca
Compare
@h7x4 all done ! Thanks for the review |
Settings = { | ||
epp_state_for_AC = mkOption { | ||
type = types.str; | ||
default = "balance_performance"; |
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.
@h7x4, I had to make changes, i realized i inverted the defaults for battery and ac modes... This was power before.
|
||
epp_state_for_BAT = mkOption { | ||
type = types.str; | ||
default = "power"; |
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.
@h7x4, I had to make changes, i realized i inverted the defaults for battery and ac modes... This was balance_performance before
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.
Some final comments
all done, thanks |
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.
Result of nixpkgs-review pr 261378
run on x86_64-linux 1
2 packages blacklisted:
- nixos-install-tools
- tests.nixos-functions.nixos-test
1 package built:
- auto-epp
I also built the manual with nix build github:nixos/nixpkgs/refs/pull/261378/head#htmlDocs.nixosManual
.
Couple of nits, yet to test building the module.
After committing the suggestions, there's an issue with build manual:
Looks like we can't use config.xxx in the docs. Should we hardcode the url to point to the github repo instead ? |
Yes, I think that would be good. Most module docs point to the projects main branch, so maybe |
done |
nixos/services/hardware/auto-epp-go: init
module to set up auto-epp-go with its kernel parameter, systemd service and config file
Description of changes
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)