nixos/garage: fix StateDirectory check to work with multiple data_dirs
This commit is contained in:
parent
cb905a5649
commit
4d3d3e46fe
@ -11,6 +11,13 @@ let
|
||||
cfg = config.services.garage;
|
||||
toml = pkgs.formats.toml { };
|
||||
configFile = toml.generate "garage.toml" cfg.settings;
|
||||
|
||||
anyHasPrefix =
|
||||
prefix: strOrList:
|
||||
if isString strOrList then
|
||||
hasPrefix prefix strOrList
|
||||
else
|
||||
any ({ path, ... }: hasPrefix prefix path) strOrList;
|
||||
in
|
||||
{
|
||||
meta = {
|
||||
@ -162,7 +169,7 @@ in
|
||||
ExecStart = "${cfg.package}/bin/garage server";
|
||||
|
||||
StateDirectory = mkIf (
|
||||
hasPrefix "/var/lib/garage" cfg.settings.data_dir
|
||||
anyHasPrefix "/var/lib/garage" cfg.settings.data_dir
|
||||
|| hasPrefix "/var/lib/garage" cfg.settings.metadata_dir
|
||||
) "garage";
|
||||
DynamicUser = lib.mkDefault true;
|
||||
|
Loading…
Reference in New Issue
Block a user