Closed Munksgaard closed 4 weeks ago
as both cat and pg_dump are present on the system, and I can run
As I know, NixOS package doesn't use your environment.systemPackages
settings, which mean what you can use in your shell environment doesn't mean the package can use.
User can use cat
and whatever command they like in encryption_passcommand
, I can't put everything in propagatedBuildInputs
.
So my suggestion is to use the ${pkgs.xxx}/bin/xxx
format when using a command provided by other packages.
As for your pg_dump command not found, I suggest change it into
postgresql_databases = [{
name = "foodb";
username = "postgres";
# "custom" allows us to use pg_restore (and borgmatic) to restore the
# database
format = "custom";
# Compression is handled by borg
options = "--compress=0";
+ pg_dump_command = "${pkgs.postgresql}/bin/pg_dump";
}];
I also noticed that borgmatics default value for source_directories, null, causes an error when the borgmatic service is run.
Good caught, I will file a PR to change the default value.
As for your pg_dump command not found, I suggest change it into
This works, but I'm curious why it's not the default? As is, the service doesn't work for postgres dumps?
If we make this default, I think it will add those packages (pkgs.{mysql,postgresql,mariadb}) to nix store even the user doesn't need it. And I prefer to keep the package in minimal.
Personally, I use the following code to use mysqldump
systemd.services.borgmatic.path = [ pkgs.mariadb ];
That's fair. Thanks for the feedback :-)
Do we leave this issue open until #332162 has been merged?
You can keep it open, it will auto close once merged.
Describe the bug
I've set up a borgmatic backup script using the borgmatic service. I can run the backup manually by running
borgmatic
as root, butsystemctl start borgmatic.service
fails with the following error:Here is the service definition I used:
I then tried to pass an absolute path to cat, by replacing
cat
with${pkgs.coreutils}/bin/cat
and got the following similar error:Steps To Reproduce
Steps to reproduce the behavior:
borgmatic
and observe that running it manually works.systemctl start borgmatic.service
journalctl -fu borgmatic.service
Expected behavior
No errors, as both
cat
andpg_dump
are present on the system, and I can runAdditional context
I also noticed that borgmatics default value for
source_directories
,null
, causes an error when the borgmatic service is run.Notify maintainers
@imlonghao
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.