Add missing programs to $PATH
in scripts
This commit is contained in:
parent
466c687ba5
commit
ac265706dd
1 changed files with 49 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, osConfig, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.programs.rclone;
|
cfg = config.programs.rclone;
|
||||||
targetName = "rclone";
|
targetName = "rclone";
|
||||||
|
@ -411,17 +411,30 @@ in {
|
||||||
|
|
||||||
ExecStartPre =
|
ExecStartPre =
|
||||||
let
|
let
|
||||||
script = pkgs.writeShellScriptBin "rclone-pre" ''
|
script = pkgs.writeShellApplication {
|
||||||
${pkgs.coreutils}/bin/sleep 10
|
name = "rclone-pre";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.coreutils
|
||||||
|
];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
sleep 10
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
(lib.getExe script);
|
(lib.getExe script);
|
||||||
|
|
||||||
ExecStart =
|
ExecStart =
|
||||||
let
|
let
|
||||||
script = pkgs.writeShellScriptBin "rclone" ''
|
script = pkgs.writeShellApplication {
|
||||||
|
name = "rclone";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.systemd
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
systemctl --user start rclone.target
|
systemctl --user start rclone.target
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
(lib.getExe script);
|
(lib.getExe script);
|
||||||
};
|
};
|
||||||
|
@ -456,21 +469,39 @@ in {
|
||||||
configFile = pkgs.writeText
|
configFile = pkgs.writeText
|
||||||
"${serviceName}.conf"
|
"${serviceName}.conf"
|
||||||
(lib.generators.toINI { } { ${name} = sync.config; });
|
(lib.generators.toINI { } { ${name} = sync.config; });
|
||||||
script = pkgs.writeShellScriptBin serviceName ''
|
script = pkgs.writeShellApplication {
|
||||||
|
name = serviceName;
|
||||||
|
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.coreutils
|
||||||
|
pkgs.rclone
|
||||||
|
(dirOf osConfig.security.wrapperDir)
|
||||||
|
];
|
||||||
|
|
||||||
|
text = ''
|
||||||
${sync.secretsScript}
|
${sync.secretsScript}
|
||||||
mkdir -p ${sync.path}
|
mkdir -p ${sync.path}
|
||||||
mkdir -p /tmp/rclone
|
mkdir -p /tmp/rclone
|
||||||
${lib.getExe pkgs.rclone} mount ${
|
rclone mount ${
|
||||||
builtins.concatStringsSep " " (cfg.globalArgs ++ sync.args)
|
builtins.concatStringsSep " " (cfg.globalArgs ++ sync.args)
|
||||||
} --config ${configFile} ${name}: ${sync.path}
|
} --config ${configFile} ${name}: ${sync.path}
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
(lib.getExe script);
|
(lib.getExe script);
|
||||||
ExecStop =
|
ExecStop =
|
||||||
let
|
let
|
||||||
script = pkgs.writeShellScriptBin "${serviceName}-stop" ''
|
script = pkgs.writeShellApplication {
|
||||||
|
name = "${serviceName}-stop";
|
||||||
|
|
||||||
|
runtimeInputs = [
|
||||||
|
(dirOf osConfig.security.wrapperDir)
|
||||||
|
];
|
||||||
|
|
||||||
|
text = ''
|
||||||
furermount -zu ${sync.path}
|
furermount -zu ${sync.path}
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
(lib.getExe script);
|
(lib.getExe script);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue