Unverified Commit ae908327 authored by Florian Klink's avatar Florian Klink Committed by GitHub
Browse files

nixos/alloy: automaticlly include all .alloy files in reload trigger (#388634)

parents a8dc55f4 6fdc890e
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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;