nix: use lib.getExe for executables

This commit is contained in:
Aly Raffauf 2024-05-05 19:44:51 -04:00
parent 5634e4e8a3
commit 7ebe3a1da2
2 changed files with 7 additions and 7 deletions

View file

@ -10,7 +10,7 @@
lib.mkEnableOption "Enable greetd."; lib.mkEnableOption "Enable greetd.";
alyraffauf.desktop.greetd.session = lib.mkOption { alyraffauf.desktop.greetd.session = lib.mkOption {
description = "Default command to execute on login."; description = "Default command to execute on login.";
default = config.programs.hyprland.package + "/bin/Hyprland"; default = lib.getExe config.programs.hyprland.package;
type = lib.types.str; type = lib.types.str;
}; };
alyraffauf.desktop.greetd.autologin.enable = lib.mkOption { alyraffauf.desktop.greetd.autologin.enable = lib.mkOption {
@ -33,7 +33,7 @@
if config.alyraffauf.desktop.greetd.autologin.enable if config.alyraffauf.desktop.greetd.autologin.enable
then { then {
default_session = { default_session = {
command = lib.mkDefault "${pkgs.greetd.tuigreet}/bin/tuigreet --asterisks -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.alyraffauf.desktop.greetd.session}"; command = lib.mkDefault "${lib.getExe pkgs.greetd.tuigreet} --asterisks -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.alyraffauf.desktop.greetd.session}";
}; };
initial_session = { initial_session = {
command = config.alyraffauf.desktop.greetd.session; command = config.alyraffauf.desktop.greetd.session;
@ -42,7 +42,7 @@
} }
else { else {
default_session = { default_session = {
command = lib.mkDefault "${pkgs.greetd.tuigreet}/bin/tuigreet --asterisks -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.alyraffauf.desktop.greetd.session}"; command = lib.mkDefault "${lib.getExe pkgs.greetd.tuigreet} --asterisks -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.alyraffauf.desktop.greetd.session}";
}; };
}; };
}; };

View file

@ -10,16 +10,16 @@
GIT=https://''${FLAKE//:/\.com\/}.git GIT=https://''${FLAKE//:/\.com\/}.git
if [ "$1" == "sync" ]; then if [ "$1" == "sync" ]; then
sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake $FLAKE#$HOST sudo ${lib.getExe pkgs.nixos-rebuild} switch --flake $FLAKE#$HOST
exit 0; exit 0;
elif [ "$1" == "boot" ]; then elif [ "$1" == "boot" ]; then
bin/sudo ${pkgs.nixos-rebuild}/bin/nixos-rebuild boot --flake $FLAKE#$HOST sudo ${lib.getExe pkgs.nixos-rebuild} boot --flake $FLAKE#$HOST
exit 0; exit 0;
elif [ "$1" == "gc" ]; then elif [ "$1" == "gc" ]; then
sudo ${pkgs.nix}/bin/nix-collect-garbage -d sudo ${lib.getExe' pkgs.nix "nix-collect-garbage"} -d
exit 0; exit 0;
elif [ "$1" == "clone" ]; then elif [ "$1" == "clone" ]; then
${pkgs.git}/bin/git clone $GIT ${lib.getExe pkgs.git} clone $GIT
cd nixcfg cd nixcfg
exit 0; exit 0;
fi fi