On NixOS 23.05 I'm unable to use sanoid --monitor-* commands (--monitor-health
, --monitor-capacity
, --monitor-snapshots
) on the CLI and in scripts.
This because the configuration file sanoid relies on (by default /etc/sanoid/sanoid.conf) doesn't exist.
I know that the actual config file used by the sanoid service it's the one generated by the sanoid derivation, if I do systemctl cat sanoid
I can see:
...
ExecStart='/nix/store/mfhah82mjcffc9y7hvx60gpdk2f0183h-sanoid-2.1.0/bin/sanoid' '--cron' '--configdir' '/nix/store/gggb1m057i9x7zqif5sfpv54j8j2hbn4-sanoid.conf'
...
If I do
sanoid --monitor-health --configdir /nix/store/gggb1m057i9x7zqif5sfpv54j8j2hbn4-sanoid.conf
the command behave as expected**.
But I have a health-monitoring script relying on the sanoid --monitor-health
&co commands...For what I can understand the sanoid.conf path will change on the next sanoid update, so it's rather inconvenient hard-coding that path in the scrip or linking /etc/sanoid
to it.
I was wondering if there is a nice way to handle this situation...
**: actually, sometimes it works, sometimes I have another error:
mkdir /var/cache/sanoid: File exists at /nix/store/s71k9hy54qq4xgjkx6w7rcgkf6b8yq3n-sanoid-2.1.0/bin/.sanoid-wrapped line 55.