mirror of
https://github.com/zaphar/Heracles.git
synced 2025-07-24 21:09:52 -04:00
maint: NixOS module writes config to the Nix store
Instead of writing the config attrset to a YAML file to a fixed path in /etc, this makes the NixOS module write to a (content-addressed) config file in the Nix store. We just use builtins.toJSON since YAML is a superset of JSON.
This commit is contained in:
parent
668015ed17
commit
94b05b1437
@ -112,11 +112,9 @@
|
|||||||
|
|
||||||
config = let
|
config = let
|
||||||
cfg = config.services.heracles;
|
cfg = config.services.heracles;
|
||||||
|
cfgFile = pkgs.writeText "heracles.yaml" (builtins.toJSON cfg.settings);
|
||||||
in
|
in
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
environment.etc."heracles.yaml" = {
|
|
||||||
text = lib.generators.toYAML {} cfg.settings;
|
|
||||||
};
|
|
||||||
systemd.services.heracles = {
|
systemd.services.heracles = {
|
||||||
wantedBy = ["multi-user.target" "default.target"];
|
wantedBy = ["multi-user.target" "default.target"];
|
||||||
wants = ["network.target"];
|
wants = ["network.target"];
|
||||||
@ -124,7 +122,7 @@
|
|||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "30s";
|
RestartSec = "30s";
|
||||||
ExecStart = "${pkgs.heracles}/bin/heracles --listen ${cfg.listen} --config=${config.environment.etc."heracles.yaml".target}";
|
ExecStart = "${pkgs.heracles}/bin/heracles --listen ${cfg.listen} --config=${cfgFile}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user