mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
nixos/cpu-energy-meter: init
This commit is contained in:
parent
628f13c025
commit
c250e8ee94
@ -167,6 +167,7 @@
|
||||
./programs/chromium.nix
|
||||
./programs/clash-verge.nix
|
||||
./programs/cnping.nix
|
||||
./programs/cpu-energy-meter.nix
|
||||
./programs/command-not-found/command-not-found.nix
|
||||
./programs/coolercontrol.nix
|
||||
./programs/criu.nix
|
||||
|
27
nixos/modules/programs/cpu-energy-meter.nix
Normal file
27
nixos/modules/programs/cpu-energy-meter.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}: {
|
||||
options.programs.cpu-energy-meter = {
|
||||
enable = lib.mkEnableOption "CPU Energy Meter";
|
||||
package = lib.mkPackageOption pkgs "cpu-energy-meter" { };
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.programs.cpu-energy-meter;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
hardware.cpu.x86.msr.enable = true;
|
||||
|
||||
security.wrappers.${cfg.package.meta.mainProgram} = {
|
||||
owner = "nobody";
|
||||
group = config.hardware.cpu.x86.msr.group;
|
||||
source = lib.getExe cfg.package;
|
||||
capabilities = "cap_sys_rawio=ep";
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ lorenzleutgeb ];
|
||||
}
|
Loading…
Reference in New Issue
Block a user