nixos/alloy: automaticlly include all .alloy files in reload trigger (#388634)
This commit is contained in:
@@ -30,12 +30,10 @@ in
|
||||
configuration file via `environment.etc."alloy/config.alloy"`.
|
||||
|
||||
This allows config reload, contrary to specifying a store path.
|
||||
A `reloadTrigger` for `config.alloy` is configured.
|
||||
|
||||
Other `*.alloy` files in the same directory (ignoring subdirs) are also
|
||||
honored, but it's necessary to manually extend
|
||||
`systemd.services.alloy.reloadTriggers` to enable config reload
|
||||
during nixos-rebuild switch.
|
||||
All `.alloy` files in the same directory (ignoring subdirs) are also
|
||||
honored and are added to `systemd.services.alloy.reloadTriggers` to
|
||||
enable config reload during nixos-rebuild switch.
|
||||
|
||||
This can also point to another directory containing `*.alloy` files, or
|
||||
a single Alloy file in the Nix store (at the cost of reload).
|
||||
@@ -68,7 +66,9 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.alloy = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
reloadTriggers = [ config.environment.etc."alloy/config.alloy".source or null ];
|
||||
reloadTriggers = lib.mapAttrsToList (_: v: v.source or null) (
|
||||
lib.filterAttrs (n: _: lib.hasPrefix "alloy/" n && lib.hasSuffix ".alloy" n) config.environment.etc
|
||||
);
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
DynamicUser = true;
|
||||
|
||||
Reference in New Issue
Block a user