Merge pull request #271342 from PhDyellow/ryzen_smu

ryzen_smu: init at 0.1.5, ryzen_monitor_ng: init at 2.0.5
This commit is contained in:
Aleksana 2024-04-12 00:15:45 +08:00 committed by GitHub
commit 029c95c780
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 185 additions and 0 deletions

View file

@ -15508,6 +15508,12 @@
fingerprint = "7756 E88F 3C6A 47A5 C5F0 CDFB AB54 6777 F93E 20BF";
}];
};
phdyellow = {
name = "Phil Dyer";
email = "phildyer@protonmail.com";
github = "PhDyellow";
githubId = 7740661;
};
phfroidmont = {
name = "Paul-Henri Froidmont";
email = "nix.contact-j9dw4d@froidmont.org";

View file

@ -90,6 +90,10 @@ Use `services.pipewire.extraConfig` or `services.pipewire.configPackages` for Pi
- [maubot](https://github.com/maubot/maubot), a plugin-based Matrix bot framework. Available as [services.maubot](#opt-services.maubot.enable).
- [ryzen-monitor-ng](https://github.com/mann1x/ryzen_monitor_ng), a desktop AMD CPU power monitor and controller, similar to Ryzen Master but for Linux. Available as [programs.ryzen-monitor-ng](#opt-programs.ryzen-monitor-ng.enable)
- [ryzen-smu](https://gitlab.com/leogx9r/ryzen_smu), Linux kernel driver to expose the SMU (System Management Unit) for certain AMD Ryzen Processors. Includes the userspace program `monitor_cpu`. Available at [hardward.cpu.amd.ryzen-smu](#opt-hardware.cpu.amd.ryzen-smu.enable)
- systemd's gateway, upload, and remote services, which provides ways of sending journals across the network. Enable using [services.journald.gateway](#opt-services.journald.gateway.enable), [services.journald.upload](#opt-services.journald.upload.enable), and [services.journald.remote](#opt-services.journald.remote.enable).
- [GNS3](https://www.gns3.com/), a network software emulator. Available as [services.gns3-server](#opt-services.gns3-server.enable).

View file

@ -0,0 +1,26 @@
{ config
, lib
, ...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.hardware.cpu.amd.ryzen-smu;
ryzen-smu = config.boot.kernelPackages.ryzen-smu;
in
{
options.hardware.cpu.amd.ryzen-smu = {
enable = mkEnableOption ''
ryzen_smu, a linux kernel driver that exposes access to the SMU (System Management Unit) for certain AMD Ryzen Processors.
WARNING: Damage cause by use of your AMD processor outside of official AMD specifications or outside of factory settings are not covered under any AMD product warranty and may not be covered by your board or system manufacturer's warranty
'';
};
config = mkIf cfg.enable {
boot.kernelModules = [ "ryzen-smu" ];
boot.extraModulePackages = [ ryzen-smu ];
environment.systemPackages = [ ryzen-smu ];
};
meta.maintainers = with lib.maintainers; [ Cryolitia phdyellow ];
}

View file

@ -54,6 +54,7 @@
./hardware/corectrl.nix
./hardware/cpu/amd-microcode.nix
./hardware/cpu/amd-sev.nix
./hardware/cpu/amd-ryzen-smu.nix
./hardware/cpu/intel-microcode.nix
./hardware/cpu/intel-sgx.nix
./hardware/cpu/x86-msr.nix
@ -251,6 +252,7 @@
./programs/regreet.nix
./programs/rog-control-center.nix
./programs/rust-motd.nix
./programs/ryzen-monitor-ng.nix
./programs/screen.nix
./programs/seahorse.nix
./programs/sedutil.nix

View file

@ -0,0 +1,35 @@
{ pkgs
, config
, lib
, ...
}:
let
inherit (lib) mkEnableOption mkPackageOption mkIf;
cfg = config.programs.ryzen-monitor-ng;
in
{
options = {
programs.ryzen-monitor-ng = {
enable = mkEnableOption ''
ryzen_monitor_ng, a userspace application for setting and getting Ryzen SMU (System Management Unit) parameters via the ryzen_smu kernel driver.
Monitor power information of Ryzen processors via the PM table of the SMU.
SMU Set and Get for many parameters and CO counts.
https://github.com/mann1x/ryzen_monitor_ng
WARNING: Damage cause by use of your AMD processor outside of official AMD specifications or outside of factory settings are not covered under any AMD product warranty and may not be covered by your board or system manufacturer's warranty
'';
package = mkPackageOption pkgs "ryzen-monitor-ng" {};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
hardware.cpu.amd.ryzen-smu.enable = true;
};
meta.maintainers = with lib.maintainers; [ Cryolitia phdyellow ];
}

View file

@ -0,0 +1,41 @@
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation {
pname = "ryzen-monitor-ng";
version = "2.0.5-unstable-2023-11-05";
# Upstream has not updated ryzen_smu header version
# This fork corrects ryzen_smu header version and
# adds support for Matisse AMD CPUs.
src = fetchFromGitHub {
owner = "plasmin";
repo = "ryzen_monitor_ng";
rev = "8b7854791d78de731a45ce7d30dd17983228b7b1";
hash = "sha256-fcW2fEsCFliRnMFnboR0jchzVIlCYbr2AE6AS06cb6o=";
};
## Remove binaries committed into upstream repo
preBuild = ''
rm src/ryzen_monitor
'';
makeTargets = [ "clean" "install" ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mv ./src/ryzen_monitor $out/bin
runHook postInstall
'';
meta = with lib; {
description = "Access Ryzen SMU information exposed by the ryzen_smu driver";
homepage = "https://github.com/mann1x/ryzen_monitor_ng";
license = licenses.agpl3Only;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ phdyellow ];
mainProgram = "ryzen_monitor";
};
}

View file

@ -0,0 +1,69 @@
{ lib
, stdenv
, fetchFromGitHub
, kernel
}:
let
version = "0.1.5-unstable-2024-01-03";
## Upstream has not been merging PRs.
## Nixpkgs maintainers are providing a
## repo with PRs merged until upstream is
## updated.
src = fetchFromGitHub {
owner = "Cryolitia";
repo = "ryzen_smu";
rev = "ce1aa918efa33ca79998f0f7d467c04d4b07016c";
hash = "sha256-s9SSmbL6ixWqZUKEhrZdxN4xoWgk+8ClZPoKq2FDAAE=";
};
monitor-cpu = stdenv.mkDerivation {
pname = "monitor-cpu";
inherit version src;
makeFlags = [
"-C userspace"
];
installPhase = ''
runHook preInstall
install userspace/monitor_cpu -Dm755 -t $out/bin
runHook postInstall
'';
};
in
stdenv.mkDerivation {
pname = "ryzen-smu-${kernel.version}";
inherit version src;
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = [
"TARGET=${kernel.modDirVersion}"
"KERNEL_BUILD=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
installPhase = ''
runHook preInstall
install ryzen_smu.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/ryzen_smu
install ${monitor-cpu}/bin/monitor_cpu -Dm755 -t $out/bin
runHook postInstall
'';
meta = with lib; {
description = "A Linux kernel driver that exposes access to the SMU (System Management Unit) for certain AMD Ryzen Processors";
homepage = "https://gitlab.com/leogx9r/ryzen_smu";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ Cryolitia phdyellow ];
platforms = [ "x86_64-linux" ];
mainProgram = "monitor_cpu";
};
}

View file

@ -548,6 +548,8 @@ in {
ithc = callPackage ../os-specific/linux/ithc { };
ryzen-smu = callPackage ../os-specific/linux/ryzen-smu { };
zenpower = callPackage ../os-specific/linux/zenpower { };
zfs_2_1 = callPackage ../os-specific/linux/zfs/2_1.nix {