Refactor: Structured Configuration Support for Home Manager Module#667
Refactor: Structured Configuration Support for Home Manager Module#667ananyatimalsina wants to merge 9 commits intomangowm:mainfrom
Conversation
Convert settings from raw text to structured Nix attrs, following Hyprland's module pattern. Implementation based 1:1 on Hyprland's design - all credit to the Hyprland project. - Add nix/lib.nix with toMango conversion function - Support nested attrs, lists for duplicate keys - Add extraConfig, topPrefixes, bottomPrefixes options - Auto-add exec-once for autostart.sh Adapted for mangowc syntax (underscore separators vs colons).
|
How does this work for keymodes? |
|
Oversight on my part, thanks for pointing that out! It should work now with the new keymode syntax being: settings = {
bind = [
"ALT,R,setkeymode,resize" # Enter resize mode
];
# Keymodes (submaps) for modal keybindings
keymode = {
resize = {
bind = [
"NONE,Left,resizewin,-10,0"
"NONE,Escape,setkeymode,default"
];
};
};
}; |
|
Could we possibly implement a check for the old config and show an evaluation warning, so there can possibly be a buffering period? Some people might just want to update mango, but refactor their expression at a later date. I think |
|
Done |
|
Alright, cool! |
dc016eb to
6b2d694
Compare
|
Looks good to me, but
|
|
I think its also worth validating the config, like I do in #655 |
I think that would be not easy to maintain, because of the config specs do change a bit, whilst |
|
I don't quite understand what you mean by that? |
|
nevemind then, i wasnt aware -c existed, nor could do that |
Uses `pkgs.runCommand` in the home-manager module to parse and validate the generated config file prior to deployment, preventing broken setups.
Done, pretty much a copy paste of your approach thx a lot |
|
Sorry if this is just considered noise for the PR, but thanks, @ananyatimalsina, for putting this together! I've been looking to migrate from Hyprland to MangoWC and I had some mixed feelings when most of the configs were similar, but the home-manager Just giving my thumbs up that this is great deal for someone like me that was expecting a more nix-friendly home-manager configuration. |
Definitely not a noise, user testing is appreciated |
There was a problem hiding this comment.
Although the restructure settings has been working great, my systemd services were not been correctly initialized. After digging a bit, I found that if I manually added the dbus command to the autostart_sh config, things would work as expected.
wayland.windowManager.mango = {
enable = true;
systemd = {
enable = true;
variables = [ "--all" ];
};
autostart_sh = "dbus-update-activation-environment --systemd --all"; # Extra line
};I think the problem is easy to solve. You have prepended this command to the autostart_sh variable defined in the let in block, but still using the value from cfg.autostart_sh to create the file and add the exec-once command to mango.conf.
Can you review if these changes make sense?
673ec40 to
db30977
Compare
17ff2ad to
064bcad
Compare
Summary
This PR refactors the home-manager module to use structured Nix attribute sets instead of raw text configuration, following the architectural pattern from Hyprland's NixOS module.
All credit for this design goes to the Hyprland project. This is a 1:1 adaptation of their implementation, modified for mangowc's specific syntax requirements.
Motivation
The previous implementation required users to write raw config strings:
This approach had several limitations:
New Configuration Format
Backward Compatibility
settingsoption from raw text to structured attributes.Migration path: Users need to convert their configs from:
To:
For users who need raw text during migration, the new
extraConfigoption is available:Testing
nix-instantiate --parsetoMangofunction generates correct output formatexec-onceforautostart.shCredits
This implementation is based entirely on Hyprland's NixOS module architecture:
All architectural credit goes to the Hyprland development team. This PR simply adapts their excellent design to mangowc's specific syntax and requirements.
Related
autostart_shoption with enhanced automatic handling: nix home manager modules options are unintuitive #657