Skip to content

Commit ae90832

Browse files
authored
nixos/alloy: automaticlly include all .alloy files in reload trigger (#388634)
2 parents a8dc55f + 6fdc890 commit ae90832

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

nixos/modules/services/monitoring/alloy.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ in
3030
configuration file via `environment.etc."alloy/config.alloy"`.
3131
3232
This allows config reload, contrary to specifying a store path.
33-
A `reloadTrigger` for `config.alloy` is configured.
3433
35-
Other `*.alloy` files in the same directory (ignoring subdirs) are also
36-
honored, but it's necessary to manually extend
37-
`systemd.services.alloy.reloadTriggers` to enable config reload
38-
during nixos-rebuild switch.
34+
All `.alloy` files in the same directory (ignoring subdirs) are also
35+
honored and are added to `systemd.services.alloy.reloadTriggers` to
36+
enable config reload during nixos-rebuild switch.
3937
4038
This can also point to another directory containing `*.alloy` files, or
4139
a single Alloy file in the Nix store (at the cost of reload).
@@ -68,7 +66,9 @@ in
6866
config = lib.mkIf cfg.enable {
6967
systemd.services.alloy = {
7068
wantedBy = [ "multi-user.target" ];
71-
reloadTriggers = [ config.environment.etc."alloy/config.alloy".source or null ];
69+
reloadTriggers = lib.mapAttrsToList (_: v: v.source or null) (
70+
lib.filterAttrs (n: _: lib.hasPrefix "alloy/" n && lib.hasSuffix ".alloy" n) config.environment.etc
71+
);
7272
serviceConfig = {
7373
Restart = "always";
7474
DynamicUser = true;

0 commit comments

Comments
 (0)