From d683e551b48ed52d9d8aa8bd27f155da8c8d3e60 Mon Sep 17 00:00:00 2001 From: Tomate0613 <69756782+Tomate0613@users.noreply.github.com> Date: Sun, 1 Feb 2026 20:07:54 +0100 Subject: [PATCH] validate config in home-manager --- nix/hm-modules.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nix/hm-modules.nix b/nix/hm-modules.nix index 85d5790..827bb13 100644 --- a/nix/hm-modules.nix +++ b/nix/hm-modules.nix @@ -12,6 +12,18 @@ self: { ${lib.optionalString cfg.systemd.enable systemdActivation} ${cfg.autostart_sh} ''; + validatedConfig = pkgs.runCommand "mango-config.conf" { } '' + cat > "$out" <<'EOF' + ${cfg.settings} + EOF + + output=$(${cfg.package}/bin/mango -c "$out" -p 2>&1 || true) + + if echo "$output" | grep -Fq '[ERROR]:'; then + echo "$output" + exit 1 + fi + ''; in { options = { wayland.windowManager.mango = with lib; { @@ -99,7 +111,7 @@ in { home.packages = [cfg.package]; xdg.configFile = { "mango/config.conf" = lib.mkIf (cfg.settings != "") { - text = cfg.settings; + source = validatedConfig; }; "mango/autostart.sh" = lib.mkIf (cfg.autostart_sh != "") { source = autostart_sh;