This is my Gitea backup script configuration:
systemd.services.gitea-backup = {
description = "gitea backup";
path = [ pkgs.gitea ];
onFailure = [ "gitea-pushover@%n.service" ];
serviceConfig = {
Type = "oneshot";
User = "gitea";
WorkingDirectory = "${pathGitea}";
};
script = "${pkgs.gitea}/bin/gitea dump -c /var/lib/gitea/custom/conf/app.ini -f gitea-dump-$(date +%Y%m%d).zip";
};
systemd.services.gitea-pushover = {
description = "gitea pushover";
serviceConfig = {
Type = "oneshot";
User = "root";
};
script = "${pkgs.python3}/bin/python3 /root/bin/script.py";
};
environment.systemPackages = with pkgs; [
(python3.withPackages(ps: with ps; [ requests ]))
...
...
];
systemd[1]: Starting gitea pushover ok...
4c0972k9p4hjp4pmhvrpy3cpfm1rihr6-unit-script-gitea-pushover-ok-start[1024]: Traceback (most recent call last):
4c0972k9p4hjp4pmhvrpy3cpfm1rihr6-unit-script-gitea-pushover-ok-start[1024]: File "/root/bin/botopensync.py", line 9, in <module>
4c0972k9p4hjp4pmhvrpy3cpfm1rihr6-unit-script-gitea-pushover-ok-start[1024]: import requests
4c0972k9p4hjp4pmhvrpy3cpfm1rihr6-unit-script-gitea-pushover-ok-start[1024]: ModuleNotFoundError: No module named 'requests'
systemd[1]: gitea-pushover-ok.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: gitea-pushover-ok.service: Failed with result 'exit-code'.
systemd[1]: Failed to start gitea pushover ok.
How can I add this Python module to my systemd-unit?