Add missing programs to $PATH in scripts

This commit is contained in:
Manuel Thalmann 2024-05-19 01:12:46 +02:00
parent 466c687ba5
commit ac265706dd

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, osConfig, pkgs, ... }:
let
cfg = config.programs.rclone;
targetName = "rclone";
@ -411,17 +411,30 @@ in {
ExecStartPre =
let
script = pkgs.writeShellScriptBin "rclone-pre" ''
${pkgs.coreutils}/bin/sleep 10
'';
script = pkgs.writeShellApplication {
name = "rclone-pre";
runtimeInputs = [
pkgs.coreutils
];
text = ''
sleep 10
'';
};
in
(lib.getExe script);
ExecStart =
let
script = pkgs.writeShellScriptBin "rclone" ''
systemctl --user start rclone.target
'';
script = pkgs.writeShellApplication {
name = "rclone";
runtimeInputs = [
pkgs.systemd
];
text = ''
systemctl --user start rclone.target
'';
};
in
(lib.getExe script);
};
@ -456,21 +469,39 @@ in {
configFile = pkgs.writeText
"${serviceName}.conf"
(lib.generators.toINI { } { ${name} = sync.config; });
script = pkgs.writeShellScriptBin serviceName ''
${sync.secretsScript}
mkdir -p ${sync.path}
mkdir -p /tmp/rclone
${lib.getExe pkgs.rclone} mount ${
builtins.concatStringsSep " " (cfg.globalArgs ++ sync.args)
} --config ${configFile} ${name}: ${sync.path}
'';
script = pkgs.writeShellApplication {
name = serviceName;
runtimeInputs = [
pkgs.coreutils
pkgs.rclone
(dirOf osConfig.security.wrapperDir)
];
text = ''
${sync.secretsScript}
mkdir -p ${sync.path}
mkdir -p /tmp/rclone
rclone mount ${
builtins.concatStringsSep " " (cfg.globalArgs ++ sync.args)
} --config ${configFile} ${name}: ${sync.path}
'';
};
in
(lib.getExe script);
ExecStop =
let
script = pkgs.writeShellScriptBin "${serviceName}-stop" ''
furermount -zu ${sync.path}
'';
script = pkgs.writeShellApplication {
name = "${serviceName}-stop";
runtimeInputs = [
(dirOf osConfig.security.wrapperDir)
];
text = ''
furermount -zu ${sync.path}
'';
};
in
(lib.getExe script);
};