nixos/alloy: add environmentFile option

This is a common practice among other NixOS modules, and allows
people to inject secrets via tools like `sops-nix` and similar.
This commit is contained in:
ztmr
2025-05-08 15:25:27 +01:00
committed by Tomas Morstein
parent b22909a5fe
commit cd3824f7bc

View File

@@ -48,6 +48,15 @@ in
'';
};
environmentFile = lib.mkOption {
type = with lib.types; nullOr path;
default = null;
example = "/run/secrets/alloy.env";
description = ''
EnvironmentFile as defined in {manpage}`systemd.exec(5)`.
'';
};
extraFlags = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
@@ -84,6 +93,7 @@ in
StateDirectory = "alloy";
WorkingDirectory = "%S/alloy";
Type = "simple";
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
};
};
};