From 49c7be3e0549fcc554664283097fe9acd5bff958 Mon Sep 17 00:00:00 2001 From: Igor Ramazanov Date: Tue, 11 Mar 2025 20:22:47 +0000 Subject: [PATCH] fix: NixOS module: fix `/etc/headplane/config.yaml` generation --- nix/module.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nix/module.nix b/nix/module.nix index 9343561..41eb12f 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -13,13 +13,17 @@ types ; cfg = config.services.headplane; + settingsFormat = pkgs.formats.yaml {}; + settingsFile = settingsFormat.generate "headplane-config.yaml" cfg.settings; in { options.services.headplane = { enable = mkEnableOption "headplane"; package = mkPackageOption pkgs "headplane" {}; settings = mkOption { - type = with types; attrsOf (oneOf [str int bool]); + type = types.submodule { + freeformType = settingsFormat.type; + }; default = {}; }; @@ -56,10 +60,7 @@ in { config = mkIf cfg.enable { environment.systemPackages = [cfg.package]; - environment.etc."headplane/config.yaml".source = let - format = pkgs.formats.yaml {}; - headplaneConfig = format.generate "headplane-config.yaml" cfg.settings; - in "${headplaneConfig}"; + environment.etc."headplane/config.yaml".source = "${settingsFile}"; systemd.services.headplane-agent = mkIf cfg.agent.enable