amd gpu
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
|
||||
|
||||
set $mod Mod4
|
||||
set $LeftMonitor HDMI-0
|
||||
set $RightMonitor DP-4
|
||||
set $LeftMonitor HDMI-A-0
|
||||
set $RightMonitor DisplayPort-0
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below.
|
||||
|
||||
34
.config/polybar/amd-gpu.sh
Executable file
34
.config/polybar/amd-gpu.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Base path for AMD GPU sysfs
|
||||
GPU_BASE_PATH="/sys/class/drm/card1/device"
|
||||
|
||||
# Check if AMD GPU sysfs exists
|
||||
if [ ! -d "$GPU_BASE_PATH" ]; then
|
||||
echo "---"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get GPU usage
|
||||
GPU_UTIL=$(cat "$GPU_BASE_PATH/gpu_busy_percent" 2>/dev/null || echo "N/A")
|
||||
|
||||
# Base path for hwmon (temperature and power readings)
|
||||
HWMON_PATH="$GPU_BASE_PATH/hwmon/hwmon0"
|
||||
|
||||
# Get GPU temperature
|
||||
TEMP_PATH="$HWMON_PATH/temp1_input"
|
||||
if [ -f "$TEMP_PATH" ]; then
|
||||
GPU_TEMP=$(($(cat "$TEMP_PATH") / 1000)) # Convert from millidegrees to degrees
|
||||
else
|
||||
GPU_TEMP="N/A"
|
||||
fi
|
||||
|
||||
# Get GPU power usage
|
||||
POWER_PATH="$HWMON_PATH/power1_average"
|
||||
if [ -f "$POWER_PATH" ]; then
|
||||
GPU_POWER=$(($(cat "$POWER_PATH") / 1000000)) # Convert from microwatts to watts
|
||||
else
|
||||
GPU_POWER="N/A"
|
||||
fi
|
||||
|
||||
echo "GPU ${GPU_UTIL}%, ${GPU_TEMP}°C, ${GPU_POWER}W"
|
||||
1
.config/waybar/amd-gpu.sh
Symbolic link
1
.config/waybar/amd-gpu.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../polybar/amd-gpu.sh
|
||||
17
flake.lock
generated
17
flake.lock
generated
@@ -646,6 +646,22 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-mesa-git": {
|
||||
"locked": {
|
||||
"lastModified": 1741705751,
|
||||
"narHash": "sha256-TERyCTgLllWgmuYMxbrnjjJQYkj2TT7QoTDUCT/oFOc=",
|
||||
"owner": "kropatz",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "97c017ceecbbc3a5a8e588f3f2e79182afd2dd29",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kropatz",
|
||||
"ref": "mesa-git",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1741332913,
|
||||
@@ -810,6 +826,7 @@
|
||||
"nixos-wsl": "nixos-wsl",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-gimp3": "nixpkgs-gimp3",
|
||||
"nixpkgs-mesa-git": "nixpkgs-mesa-git",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"nixvim": "nixvim",
|
||||
"nur": "nur",
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#nixpkgs-unstable.url = "github:nixos/nixpkgs/a6916c76a7d202e3c02134e620f6477b8600ce9d";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs-gimp3.url = "github:jtojnar/nixpkgs/gimp-meson";
|
||||
nixpkgs-mesa-git.url = "github:kropatz/nixpkgs/mesa-git";
|
||||
home-manager-unstable = {
|
||||
url = "github:nix-community/home-manager/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
|
||||
@@ -10,6 +10,8 @@ let
|
||||
sleep 4
|
||||
systemctl --user restart xdg-desktop-portal
|
||||
'';
|
||||
monitor1 = if isPc then "DP-1" else if isLaptop then "eDP-1" else "eDP-1";
|
||||
monitor2 = "HDMI-A-1";
|
||||
in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
@@ -28,8 +30,8 @@ in {
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Monitors/
|
||||
monitor = if isPc then [
|
||||
"HDMI-A-1,1920x1080@60,0x0,1"
|
||||
"DP-3,2560x1440@150,1920x0,1"
|
||||
"${monitor2},1920x1080@60,0x0,1"
|
||||
"${monitor1},2560x1440@144,1920x0,1"
|
||||
"Unknown-1,disable"
|
||||
] else if isLaptop then [
|
||||
# laptop
|
||||
@@ -45,13 +47,13 @@ in {
|
||||
|
||||
workspace =
|
||||
lib.lists.optionals (osConfig.networking.hostName == "kop-pc") [
|
||||
"1,monitor:DP-3"
|
||||
"2,monitor:DP-3"
|
||||
"3,monitor:DP-3"
|
||||
"4,monitor:DP-3"
|
||||
"5,monitor:DP-3"
|
||||
"9,monitor:HDMI-A-1"
|
||||
"10,monitor:HDMI-A-1"
|
||||
"1,monitor:${monitor1}"
|
||||
"2,monitor:${monitor1}"
|
||||
"3,monitor:${monitor1}"
|
||||
"4,monitor:${monitor1}"
|
||||
"5,monitor:${monitor1}"
|
||||
"9,monitor:${monitor2}"
|
||||
"10,monitor:${monitor2}"
|
||||
];
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
||||
@@ -64,7 +66,7 @@ in {
|
||||
|
||||
# Some default env vars.
|
||||
env =
|
||||
[ "XCURSOR_SIZE,24" "NIXOS_OZONE_WL,1" "WLR_NO_HARDWARE_CURSORS,1" ]
|
||||
[ "XCURSOR_SIZE,24" "NIXOS_OZONE_WL,1" ]
|
||||
++ lib.optionals osConfig.custom.hardware.nvidia.enable [
|
||||
"LIBVA_DRIVER_NAME,nvidia"
|
||||
"GBM_BACKEND,nvidia-drm"
|
||||
@@ -88,7 +90,7 @@ in {
|
||||
sensitivity = 0;
|
||||
};
|
||||
|
||||
cursor = { no_hardware_cursors = true; };
|
||||
#cursor = { no_hardware_cursors = true; };
|
||||
|
||||
#render = {
|
||||
# explicit_sync = 1;
|
||||
@@ -303,6 +305,7 @@ in {
|
||||
] ++ [
|
||||
"sleep 3 && ${pkgs.waybar}/bin/waybar &"
|
||||
"${restartPortals}"
|
||||
"xrandr --monitor ${monitor1} --primary"
|
||||
];
|
||||
};
|
||||
extraConfig = let
|
||||
|
||||
@@ -58,7 +58,7 @@ in {
|
||||
};
|
||||
|
||||
# don't autostart
|
||||
systemd.user.services.hypridle.Service.ExecStart = lib.mkForce "true";
|
||||
systemd.user.services.hypridle.Service.ExecStart = lib.mkForce "${pkgs.coreutils}/bin/true";
|
||||
systemd.user.services.hypridle.Service.Restart = lib.mkForce "no";
|
||||
services.hypridle.enable = true;
|
||||
services.hypridle.settings = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@define-color nvidia-green #76b900;
|
||||
@define-color amdgpu-red #ed1c24;
|
||||
|
||||
#other,
|
||||
#other-drawer,
|
||||
@@ -43,6 +44,10 @@
|
||||
color: @nvidia-green;
|
||||
}
|
||||
|
||||
#custom-amd-gpu {
|
||||
color: @amdgpu-red;
|
||||
}
|
||||
|
||||
#network.disconnected {
|
||||
background-color: #f53c3c;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,9 @@ in {
|
||||
modules-right = [ "group/stats" "group/other" ];
|
||||
"group/stats" = {
|
||||
"orientation" = "horizontal";
|
||||
"modules" = [ "network" "cpu" "memory" "disk" "temperature" ] ++ lib.optionals (osConfig.networking.hostName != "nix-laptop") [ "custom/nvidia" ] ;
|
||||
"modules" = [ "network" "cpu" "memory" "disk" "temperature" ]
|
||||
++ lib.optionals osConfig.custom.hardware.nvidia.enable [ "custom/nvidia" ]
|
||||
++ lib.optionals osConfig.custom.hardware.amd-gpu.enable [ "custom/amd-gpu" ];
|
||||
};
|
||||
"group/other" = {
|
||||
"orientation" = "horizontal";
|
||||
@@ -147,6 +149,11 @@ in {
|
||||
"exec" = "~/.config/waybar/nvidia.sh";
|
||||
"exec-if" = "nvidia-smi";
|
||||
};
|
||||
"custom/amd-gpu" = {
|
||||
"format" = "{}";
|
||||
"interval" = 5;
|
||||
"exec" = "~/.config/waybar/amd-gpu.sh";
|
||||
};
|
||||
"tray".icon-size = 21;
|
||||
"tray".spacing = 10;
|
||||
"hyprland/window" = {
|
||||
|
||||
@@ -55,8 +55,10 @@ in {
|
||||
module-margin = 1;
|
||||
modules-left = "i3 xwindow";
|
||||
modules-center = "";
|
||||
modules-right =
|
||||
"music network memory cpu cpu-wattage cpu-temp gpu pulseaudio date tray";
|
||||
modules-right = [ "music network memory cpu cpu-wattage cpu-temp" ]
|
||||
++ lib.optionals osConfig.custom.hardware.nvidia.enable [ "nvidia-gpu" ]
|
||||
++ lib.optionals osConfig.custom.hardware.amd-gpu.enable [ "amd-gpu" ]
|
||||
++ [ "pulseaudio date tray" ];
|
||||
cursor-click = "pointer";
|
||||
cursor-scroll = "ns-resize";
|
||||
enable-ipc = true;
|
||||
@@ -187,13 +189,20 @@ in {
|
||||
exec = "~/.config/polybar/temperature.sh";
|
||||
interval = 3;
|
||||
};
|
||||
"module/gpu" = {
|
||||
"module/nvidia-gpu" = {
|
||||
type = "custom/script";
|
||||
format-foreground = "76b900"; #nvidia green
|
||||
format-foreground = "76b900"; # nvidia green
|
||||
label = "%output:0:35:...%";
|
||||
exec = "~/.config/polybar/nvidia.sh";
|
||||
interval = 3;
|
||||
};
|
||||
"module/amd-gpu" = {
|
||||
type = "custom/script";
|
||||
format-foreground = "ed1c24";
|
||||
label = "%output:0:35:...%";
|
||||
exec = "~/.config/polybar/amd-gpu.sh";
|
||||
interval = 3;
|
||||
};
|
||||
"module/music" = {
|
||||
type = "custom/script";
|
||||
exec = "~/.config/polybar/player-mpris-simple.sh";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{pkgs, lib, ...}:
|
||||
{
|
||||
networking.networkmanager.enable = true;
|
||||
networking.networkmanager.plugins = lib.mkForce [ pkgs.networkmanager-openvpn ];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ let
|
||||
addPatches = pkg: patches:
|
||||
pkg.overrideAttrs
|
||||
(oldAttrs: { patches = (oldAttrs.patches or [ ]) ++ patches; });
|
||||
mesa-git = import inputs.nixpkgs-mesa-git {
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in {
|
||||
# This one brings our custom packages from the 'pkgs' directory
|
||||
additions = final: _prev: import ./pkgs { pkgs = final; };
|
||||
@@ -15,6 +19,9 @@ in {
|
||||
discord-canary = prev.discord-canary.override { withVencord = true; };
|
||||
discord = prev.discord.override { withVencord = true; };
|
||||
tetrio-desktop = prev.tetrio-desktop.override { withTetrioPlus = true; };
|
||||
lact = prev.rdna4-lact;
|
||||
#mesa = mesa-git.pkgs.mesa;
|
||||
#wayland-protocols = mesa-git.pkgs.wayland-protocols;
|
||||
#hyprland = prev.hyprland.overrideAttrs (oldAttrs: {
|
||||
# version = "0.45.0";
|
||||
# src = prev.fetchFromGitHub {
|
||||
|
||||
@@ -12,4 +12,5 @@
|
||||
mangal-patched = pkgs.callPackage ./mangal/default.nix { };
|
||||
electron_27 = pkgs.callPackage ./electron27/default.nix { };
|
||||
logseq = pkgs.callPackage ./logseq/default.nix { inherit electron_27; };
|
||||
rdna4-lact = pkgs.callPackage ./lact/default.nix { };
|
||||
}
|
||||
|
||||
78
pkgs/lact/default.nix
Normal file
78
pkgs/lact/default.nix
Normal file
@@ -0,0 +1,78 @@
|
||||
{ lib, rustPlatform, stdenv, fetchFromGitHub, blueprint-compiler, pkg-config
|
||||
, wrapGAppsHook4, gdk-pixbuf, gtk4, libdrm, vulkan-loader, coreutils
|
||||
, nix-update-script, hwdata, fuse }:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "lact";
|
||||
version = "0.7.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ilya-zlobintsev";
|
||||
repo = "LACT";
|
||||
#rev = "v${version}";
|
||||
#hash = "sha256-zaN6CQSeeoYFxLO6E1AMKAjeNOcPi2OsGfYkvZLPKcw=";
|
||||
rev = "e472dec45682f96a272b77d368791121e10ba7da";
|
||||
hash = "sha256-d081f49ojJzz0N28lIu3NZ8SSvSuoz2HfjQl5Zu8PpU=";
|
||||
};
|
||||
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-vc8KqMov2Og5wRS4b9n9Vixtg4vwCM/MlkCDbqsG3Kg=";
|
||||
|
||||
nativeBuildInputs =
|
||||
[ blueprint-compiler pkg-config wrapGAppsHook4 rustPlatform.bindgenHook ];
|
||||
|
||||
buildInputs = [ gdk-pixbuf gtk4 libdrm vulkan-loader hwdata fuse ];
|
||||
|
||||
# we do this here so that the binary is usable during integration tests
|
||||
RUSTFLAGS = lib.optionalString stdenv.targetPlatform.isElf
|
||||
(lib.concatStringsSep " " [
|
||||
"-C link-arg=-Wl,-rpath,${lib.makeLibraryPath [ vulkan-loader libdrm ]}"
|
||||
"-C link-arg=-Wl,--add-needed,${vulkan-loader}/lib/libvulkan.so"
|
||||
"-C link-arg=-Wl,--add-needed,${libdrm}/lib/libdrm.so"
|
||||
]);
|
||||
|
||||
checkFlags = [
|
||||
# tries and fails to initialize gtk
|
||||
"--skip=app::pages::thermals_page::fan_curve_frame::tests::set_get_curve"
|
||||
"--skip=tests::snapshot_everything"
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace lact-daemon/src/server/system.rs \
|
||||
--replace-fail 'Command::new("uname")' 'Command::new("${coreutils}/bin/uname")'
|
||||
|
||||
substituteInPlace res/lactd.service \
|
||||
--replace-fail ExecStart={lact,$out/bin/lact}
|
||||
|
||||
substituteInPlace res/io.github.lact-linux.desktop \
|
||||
--replace-fail Exec={lact,$out/bin/lact}
|
||||
|
||||
# read() looks for the database in /usr/share so we use read_from_file() instead
|
||||
substituteInPlace lact-daemon/src/server/handler.rs \
|
||||
--replace-fail 'Database::read()' 'Database::read_from_file("${hwdata}/share/hwdata/pci.ids")'
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install -Dm444 res/lactd.service -t $out/lib/systemd/system
|
||||
install -Dm444 res/io.github.lact-linux.desktop -t $out/share/applications
|
||||
install -Dm444 res/io.github.lact-linux.png -t $out/share/pixmaps
|
||||
'';
|
||||
|
||||
postFixup = lib.optionalString stdenv.targetPlatform.isElf ''
|
||||
patchelf $out/bin/.lact-wrapped \
|
||||
--add-needed libvulkan.so \
|
||||
--add-needed libdrm.so \
|
||||
--add-rpath ${lib.makeLibraryPath [ vulkan-loader libdrm ]}
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Linux GPU Configuration Tool for AMD and NVIDIA";
|
||||
homepage = "https://github.com/ilya-zlobintsev/LACT";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ figsoda atemu ];
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "lact";
|
||||
};
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
../../modules/work/vpn.nix
|
||||
../../modules/misc/faster-boot-time.nix
|
||||
../../modules/hardware/ryzen.nix
|
||||
../../modules/networkmanager.nix
|
||||
];
|
||||
|
||||
custom = {
|
||||
@@ -40,8 +41,9 @@
|
||||
services = { syncthing = { enable = true; }; };
|
||||
hardware = {
|
||||
android.enable = true;
|
||||
amd-gpu.enable = true;
|
||||
nvidia = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
clock = {
|
||||
enable = true;
|
||||
min = 210;
|
||||
@@ -75,7 +77,7 @@
|
||||
nightlight.enable = true;
|
||||
#plasma.enable = true;
|
||||
i3.enable = true;
|
||||
sway.enable = true;
|
||||
#sway.enable = true;
|
||||
hyprland.enable = true;
|
||||
#gnome.enable = true;
|
||||
#cosmic.enable = true;
|
||||
@@ -166,7 +168,6 @@
|
||||
networking.hostName = "kop-pc"; # Define your hostname.
|
||||
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
boot.initrd.systemd.network.wait-online.enable = false;
|
||||
systemd.network.wait-online.enable = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user