treewide: use 'lib.getExe' when possible

Don't use it in wireguard to keep it consistent, as only half the
commands could use it.
This commit is contained in:
Bruno BELANYI 2023-07-23 18:58:40 +01:00
parent 8f818b8611
commit 9f7472222c
12 changed files with 16 additions and 20 deletions

View file

@ -8,7 +8,7 @@ let
realName = lib.mkDefault "Bruno BELANYI"; realName = lib.mkDefault "Bruno BELANYI";
userName = lib.mkDefault (mkMailAddress address domain); userName = lib.mkDefault (mkMailAddress address domain);
passwordCommand = passwordCommand =
lib.mkDefault [ "${pkgs.ambroisie.bw-pass}/bin/bw-pass" "Mail" passName ]; lib.mkDefault [ (lib.getExe pkgs.ambroisie.bw-pass) "Mail" passName ];
address = mkMailAddress address domain; address = mkMailAddress address domain;
aliases = builtins.map (lib.flip mkMailAddress domain) aliases; aliases = builtins.map (lib.flip mkMailAddress domain) aliases;

View file

@ -9,7 +9,7 @@ in
settings = { settings = {
notify-cmd = notify-cmd =
let let
notify-send = "${pkgs.libnotify}/bin/notify-send"; notify-send = lib.getExe pkgs.libnotify;
in in
pkgs.writeScript "mail-notifier" '' pkgs.writeScript "mail-notifier" ''
SENDER="$1" SENDER="$1"

View file

@ -47,8 +47,8 @@ in
command = mkOption { command = mkOption {
type = types.str; type = types.str;
default = "${pkgs.i3lock}/bin/i3lock -n -c 000000"; default = "${lib.getExe pkgs.i3lock} -n -c 000000";
example = "\${pkgs.i3lock}/bin/i3lock -n -i lock.png"; example = "\${lib.getExe pkgs.i3lock} -n -i lock.png";
description = "Locker command to run"; description = "Locker command to run";
}; };

View file

@ -27,13 +27,13 @@ let
genMovementBindings = f: addVimKeyBindings (lib.my.genAttrs' movementKeys f); genMovementBindings = f: addVimKeyBindings (lib.my.genAttrs' movementKeys f);
# Used in multiple scripts to show messages through keybindings # Used in multiple scripts to show messages through keybindings
notify-send = "${pkgs.libnotify}/bin/notify-send"; notify-send = lib.getExe pkgs.libnotify;
# Screen backlight management # Screen backlight management
changeBacklight = "${pkgs.ambroisie.change-backlight}/bin/change-backlight"; changeBacklight = lib.getExe pkgs.ambroisie.change-backlight;
# Audio and volume management # Audio and volume management
changeAudio = "${pkgs.ambroisie.change-audio}/bin/change-audio"; changeAudio = lib.getExe pkgs.ambroisie.change-audio;
# Lock management # Lock management
toggleXautolock = toggleXautolock =

View file

@ -5,7 +5,7 @@ let
notficationCmd = notficationCmd =
let let
duration = toString (cfg.notify.delay * 1000); duration = toString (cfg.notify.delay * 1000);
notifyCmd = "${pkgs.libnotify}/bin/notify-send -u critical -t ${duration}"; notifyCmd = "${lib.getExe pkgs.libnotify} -u critical -t ${duration}";
in in
# Needs to be surrounded by quotes for systemd to launch it correctly # Needs to be surrounded by quotes for systemd to launch it correctly
''"${notifyCmd} -- 'Locking in ${toString cfg.notify.delay} seconds'"''; ''"${notifyCmd} -- 'Locking in ${toString cfg.notify.delay} seconds'"'';

View file

@ -2,7 +2,6 @@
let let
cfg = config.my.services.drone; cfg = config.my.services.drone;
hasRunner = (name: builtins.elem name cfg.runners); hasRunner = (name: builtins.elem name cfg.runners);
dockerPkg = pkgs.drone-runner-docker;
in in
{ {
config = lib.mkIf (cfg.enable && hasRunner "docker") { config = lib.mkIf (cfg.enable && hasRunner "docker") {
@ -25,7 +24,7 @@ in
EnvironmentFile = [ EnvironmentFile = [
cfg.sharedSecretFile cfg.sharedSecretFile
]; ];
ExecStart = "${dockerPkg}/bin/drone-runner-docker"; ExecStart = lib.getExe pkgs.drone-runner-docker;
User = "drone-runner-docker"; User = "drone-runner-docker";
Group = "drone-runner-docker"; Group = "drone-runner-docker";
}; };

View file

@ -2,7 +2,6 @@
let let
cfg = config.my.services.drone; cfg = config.my.services.drone;
hasRunner = (name: builtins.elem name cfg.runners); hasRunner = (name: builtins.elem name cfg.runners);
execPkg = pkgs.drone-runner-exec;
in in
{ {
config = lib.mkIf (cfg.enable && hasRunner "exec") { config = lib.mkIf (cfg.enable && hasRunner "exec") {
@ -53,7 +52,7 @@ in
EnvironmentFile = [ EnvironmentFile = [
cfg.sharedSecretFile cfg.sharedSecretFile
]; ];
ExecStart = "${execPkg}/bin/drone-runner-exec"; ExecStart = lib.getExe pkgs.drone-runner-exec;
User = "drone-runner-exec"; User = "drone-runner-exec";
Group = "drone-runner-exec"; Group = "drone-runner-exec";
}; };

View file

@ -30,7 +30,7 @@ in
serviceConfig = { serviceConfig = {
ExecStart = lib.concatStringsSep " " [ ExecStart = lib.concatStringsSep " " [
"${pkgs.flood}/bin/flood" (lib.getExe pkgs.flood)
"--port ${builtins.toString cfg.port}" "--port ${builtins.toString cfg.port}"
"--rundir /var/lib/${cfg.stateDir}" "--rundir /var/lib/${cfg.stateDir}"
]; ];

View file

@ -4,8 +4,6 @@ let
cfg = config.my.services.lohr; cfg = config.my.services.lohr;
settingsFormat = pkgs.formats.yaml { }; settingsFormat = pkgs.formats.yaml { };
lohrPkg = pkgs.ambroisie.lohr;
lohrStateDirectory = "lohr"; lohrStateDirectory = "lohr";
lohrHome = "/var/lib/lohr/"; lohrHome = "/var/lib/lohr/";
in in
@ -80,7 +78,7 @@ in
let let
configFile = settingsFormat.generate "lohr-config.yaml" cfg.setting; configFile = settingsFormat.generate "lohr-config.yaml" cfg.setting;
in in
"${lohrPkg}/bin/lohr --config ${configFile}"; "${lib.getExe pkgs.ambroisie.lohr} --config ${configFile}";
StateDirectory = lohrStateDirectory; StateDirectory = lohrStateDirectory;
WorkingDirectory = lohrHome; WorkingDirectory = lohrHome;
User = "lohr"; User = "lohr";

View file

@ -60,7 +60,7 @@ in
WorkingDirectory = "/var/lib/nginx-sso"; WorkingDirectory = "/var/lib/nginx-sso";
# The files to be merged might not have the correct permissions # The files to be merged might not have the correct permissions
ExecStartPre = ''+${pkgs.writeScript "merge-nginx-sso-config" '' ExecStartPre = ''+${pkgs.writeScript "merge-nginx-sso-config" ''
#!${pkgs.bash}/bin/bash #!${lib.getExe pkgs.bash}
rm -f '${confPath}' rm -f '${confPath}'
${utils.genJqSecretsReplacementSnippet cfg.configuration confPath} ${utils.genJqSecretsReplacementSnippet cfg.configuration confPath}
@ -70,7 +70,7 @@ in
'' ''
}''; }'';
ExecStart = lib.mkForce '' ExecStart = lib.mkForce ''
${pkg}/bin/nginx-sso \ ${lib.getExe pkg} \
--config ${confPath} \ --config ${confPath} \
--frontend-dir ${pkg}/share/frontend --frontend-dir ${pkg}/share/frontend
''; '';

View file

@ -12,7 +12,7 @@ buildGoModule rec {
vendorHash = null; vendorHash = null;
postPatch = '' postPatch = ''
sed -i -e 's,"mpv","${mpv}/bin/mpv",' ff2mpv.go sed -i -e 's,"mpv","${lib.getExe mpv}",' ff2mpv.go
''; '';
postInstall = '' postInstall = ''

View file

@ -10,7 +10,7 @@ stdenvNoCC.mkDerivation {
installPhase = installPhase =
let let
gawkCmd = lib.concatStringsSep " " [ gawkCmd = lib.concatStringsSep " " [
''${gawk}/bin/awk'' (lib.getExe gawk)
'''{sub(/\r$/,"")}'' '''{sub(/\r$/,"")}''
''{sub(/^127\.0\.0\.1/,"0.0.0.0")}'' ''{sub(/^127\.0\.0\.1/,"0.0.0.0")}''
''BEGIN { OFS = "" }'' ''BEGIN { OFS = "" }''