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";
userName = lib.mkDefault (mkMailAddress address domain);
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;
aliases = builtins.map (lib.flip mkMailAddress domain) aliases;

View File

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

View File

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

View File

@ -27,13 +27,13 @@ let
genMovementBindings = f: addVimKeyBindings (lib.my.genAttrs' movementKeys f);
# 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
changeBacklight = "${pkgs.ambroisie.change-backlight}/bin/change-backlight";
changeBacklight = lib.getExe pkgs.ambroisie.change-backlight;
# Audio and volume management
changeAudio = "${pkgs.ambroisie.change-audio}/bin/change-audio";
changeAudio = lib.getExe pkgs.ambroisie.change-audio;
# Lock management
toggleXautolock =

View File

@ -5,7 +5,7 @@ let
notficationCmd =
let
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
# Needs to be surrounded by quotes for systemd to launch it correctly
''"${notifyCmd} -- 'Locking in ${toString cfg.notify.delay} seconds'"'';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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