From a90b2ed9fdf430122a5bc474a705b64e0b741b74 Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Sun, 14 Apr 2024 13:52:01 +0200 Subject: [PATCH] Follow best practice for getting package executables --- hosts/seb-desktop/hardware.nix | 9 +++++---- modules/home/de/default.nix | 4 ++-- modules/home/de/hyprland.nix | 2 +- modules/system/dm.nix | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/hosts/seb-desktop/hardware.nix b/hosts/seb-desktop/hardware.nix index ee64a80..a74b36b 100644 --- a/hosts/seb-desktop/hardware.nix +++ b/hosts/seb-desktop/hardware.nix @@ -2,6 +2,7 @@ inputs, config, pkgs, + lib, ... }: { imports = [ @@ -70,11 +71,11 @@ before = ["fancontrol.service"]; script = '' - /run/current-system/sw/bin/touch /tmp/nvidia-gpu-temp + ${lib.getExe' pkgs.coreutils "touch"} /tmp/nvidia-gpu-temp while :; do - temp="$(/run/current-system/sw/bin/nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits)" - /run/current-system/sw/bin/echo "$((temp * 1000))" > /tmp/nvidia-gpu-temp - /run/current-system/sw/bin/sleep 2 + temp="$(${lib.getExe' config.hardware.nvidia.package "nvidia-smi"} --query-gpu=temperature.gpu --format=csv,noheader,nounits)" + ${lib.getExe' pkgs.coreutils "echo"} "$((temp * 1000))" > /tmp/nvidia-gpu-temp + ${lib.getExe' pkgs.coreutils "sleep"} 2 done ''; }; diff --git a/modules/home/de/default.nix b/modules/home/de/default.nix index 33b1356..02d4892 100644 --- a/modules/home/de/default.nix +++ b/modules/home/de/default.nix @@ -82,7 +82,7 @@ in { PartOf = ["graphical-session.target"]; }; Service = { - ExecStart = "${pkgs.syncthingtray-minimal}/bin/syncthingtray --wait"; + ExecStart = "${lib.getExe' pkgs.syncthingtray-minimal "syncthingtray"} --wait"; }; Install = { WantedBy = ["graphical-session.target"]; @@ -103,7 +103,7 @@ in { PartOf = ["graphical-session.target"]; }; Service = { - ExecStart = "${pkgs.networkmanagerapplet}/bin/nm-applet"; + ExecStart = "${lib.getExe pkgs.networkmanagerapplet}"; }; Install = { WantedBy = ["graphical-session.target"]; diff --git a/modules/home/de/hyprland.nix b/modules/home/de/hyprland.nix index 34256ec..443e29c 100644 --- a/modules/home/de/hyprland.nix +++ b/modules/home/de/hyprland.nix @@ -161,7 +161,7 @@ in { # Launch programs "$mod, RETURN, exec, $terminal" - "$mod, V, exec, ${pkgs.cliphist}/bin/cliphist list | rofi -dmenu | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy" + "$mod, V, exec, ${lib.getExe pkgs.cliphist} list | rofi -dmenu | ${lib.getExe pkgs.cliphist} decode | ${lib.getExe' pkgs.wl-clipboard "wl-copy"}" "$mod, B, exec, $browser" "$mod, F, exec, $fileManager" "$mod, C, exec, $editor" diff --git a/modules/system/dm.nix b/modules/system/dm.nix index 10df087..2749d27 100644 --- a/modules/system/dm.nix +++ b/modules/system/dm.nix @@ -23,7 +23,7 @@ in { default_session = let base = config.services.xserver.displayManager.sessionData.desktops; in { - command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --asterisks --remember --remember-user-session --sessions ${base}/share/wayland-sessions:${base}/share/xsessions"; + command = "${lib.getExe pkgs.greetd.tuigreet} --time --asterisks --remember --remember-user-session --sessions ${base}/share/wayland-sessions:${base}/share/xsessions"; user = "greeter"; }; };