validate config in home-manager

This commit is contained in:
Tomate0613 2026-02-11 16:55:57 +01:00
parent 8484093e32
commit b033898761

View file

@ -12,6 +12,13 @@ self: {
${lib.optionalString cfg.systemd.enable systemdActivation}
${cfg.autostart_sh}
'';
validatedConfig = pkgs.runCommand "mango-config.conf" { } ''
cat > "$out" <<'EOF'
${cfg.settings}
EOF
${cfg.package}/bin/mango -c "$out" -p || exit 1
'';
in {
options = {
wayland.windowManager.mango = with lib; {
@ -99,7 +106,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;