From b3ed736c15e41dcb16d1973c5cce44619579f636 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sat, 16 Dec 2023 22:48:27 +0800 Subject: [PATCH] treewide: use lib.getExe --- nixos/profiles/opt-in/gaming.nix | 4 ++-- .../applications/rofi/default.nix | 8 ++++++-- .../applications/sway/default.nix | 20 +++++++++---------- .../applications/swayidle/default.nix | 2 +- .../profiles/opt-in/clash-meta-client.nix | 3 ++- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/nixos/profiles/opt-in/gaming.nix b/nixos/profiles/opt-in/gaming.nix index f607179..9c26fda 100644 --- a/nixos/profiles/opt-in/gaming.nix +++ b/nixos/profiles/opt-in/gaming.nix @@ -8,8 +8,8 @@ programs.gamemode = { enable = true; settings.custom = { - start = "${pkgs.libnotify}/bin/notify-send 'GameMode Activated' 'GameMode Activated! Enjoy enhanced performance. 🚀'"; - end = "${pkgs.libnotify}/bin/notify-send 'GameMode Deactivated' 'GameMode Deactivated. Back to normal mode. ⏚ī¸'"; + start = "${lib.getExe pkgs.libnotify} 'GameMode Activated' 'GameMode Activated! Enjoy enhanced performance. 🚀'"; + end = "${lib.getExe pkgs.libnotify} 'GameMode Deactivated' 'GameMode Deactivated. Back to normal mode. ⏚ī¸'"; }; }; diff --git a/users/guanranwang/home-manager/applications/rofi/default.nix b/users/guanranwang/home-manager/applications/rofi/default.nix index cd56ffa..388db96 100644 --- a/users/guanranwang/home-manager/applications/rofi/default.nix +++ b/users/guanranwang/home-manager/applications/rofi/default.nix @@ -1,9 +1,13 @@ -{pkgs, ...}: { +{ + pkgs, + lib, + ... +}: { programs.rofi = { enable = true; package = pkgs.rofi-wayland; font = "monospace"; - terminal = "${pkgs.alacritty}/bin/alacritty"; + terminal = lib.getExe pkgs.alacritty; }; home.packages = with pkgs; [rofi-power-menu]; diff --git a/users/guanranwang/home-manager/applications/sway/default.nix b/users/guanranwang/home-manager/applications/sway/default.nix index 5ac0d4f..00fc8a9 100644 --- a/users/guanranwang/home-manager/applications/sway/default.nix +++ b/users/guanranwang/home-manager/applications/sway/default.nix @@ -47,14 +47,14 @@ systemd.xdgAutostart = true; config = { ### Default Applications - terminal = "${pkgs.alacritty}/bin/alacritty"; - menu = "${pkgs.rofi}/bin/rofi"; + terminal = lib.getExe pkgs.alacritty; + menu = lib.getExe config.programs.rofi.package; ### Visuals #window.titlebar = false; bars = [ { - command = "${pkgs.waybar}/bin/waybar"; + command = lib.getExe pkgs.waybar; } #{ # statusCommand = "${lib.getExe pkgs.i3status-rust} $HOME/.config/i3status-rust/config-default.toml"; @@ -143,7 +143,7 @@ # Rofi "${modifier}+d" = "exec ${menu} -show drun -show-icons -icon-theme ${config.gtk.iconTheme.name}"; - "${modifier}+Shift+d" = "exec ${pkgs.cliphist}/bin/cliphist list | ${menu} -dmenu | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy"; + "${modifier}+Shift+d" = "exec ${lib.getExe pkgs.cliphist} list | ${menu} -dmenu | ${lib.getExe pkgs.cliphist} decode | ${pkgs.wl-clipboard}/bin/wl-copy"; "${modifier}+Shift+l" = ''exec ${menu} -modi "power-menu:rofi-power-menu --confirm=reboot/shutdown" -show power-menu''; # Screenshot @@ -157,12 +157,12 @@ "XF86AudioRaiseVolume" = "exec ${setVolume} up"; "XF86AudioLowerVolume" = "exec ${setVolume} down"; "XF86AudioMute" = "exec ${setVolume} mute"; - "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; - "XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; - "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; - "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; - "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop"; - "XF86AudioMedia" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "XF86AudioPlay" = "exec ${lib.getExe pkgs.playerctl} play-pause"; + "XF86AudioPause" = "exec ${lib.getExe pkgs.playerctl} play-pause"; + "XF86AudioPrev" = "exec ${lib.getExe pkgs.playerctl} previous"; + "XF86AudioNext" = "exec ${lib.getExe pkgs.playerctl} next"; + "XF86AudioStop" = "exec ${lib.getExe pkgs.playerctl} stop"; + "XF86AudioMedia" = "exec ${lib.getExe pkgs.playerctl} play-pause"; }; }; }; diff --git a/users/guanranwang/home-manager/applications/swayidle/default.nix b/users/guanranwang/home-manager/applications/swayidle/default.nix index 1b53cd9..d912996 100644 --- a/users/guanranwang/home-manager/applications/swayidle/default.nix +++ b/users/guanranwang/home-manager/applications/swayidle/default.nix @@ -17,7 +17,7 @@ timeouts = [ { timeout = 60 * 9; - command = ''${pkgs.libnotify}/bin/notify-send -u critical --expire-time 60000 "60 seconds until lock!"''; + command = ''${lib.getExe pkgs.libnotify} -u critical --expire-time 60000 "60 seconds until lock!"''; } { timeout = 60 * 10; diff --git a/users/guanranwang/nixos/profiles/opt-in/clash-meta-client.nix b/users/guanranwang/nixos/profiles/opt-in/clash-meta-client.nix index 214a321..ac4fd4e 100644 --- a/users/guanranwang/nixos/profiles/opt-in/clash-meta-client.nix +++ b/users/guanranwang/nixos/profiles/opt-in/clash-meta-client.nix @@ -2,6 +2,7 @@ pkgs, config, inputs, + lib, ... }: { ### sops-nix @@ -34,7 +35,7 @@ WorkingDirectory = "/etc/clash-meta"; User = [config.users.users."clash-meta".name]; Group = [config.users.groups."clash-meta".name]; - ExecStart = "${pkgs.clash-meta}/bin/clash-meta -d /etc/clash-meta"; + ExecStart = "${lib.getExe pkgs.clash-meta} -d /etc/clash-meta"; Restart = "on-failure"; CapabilityBoundingSet = [ "CAP_NET_ADMIN"