feat(nix): add homeManagerModule for declarative settings - #199
feat(nix): add homeManagerModule for declarative settings#199roeybenarieh wants to merge 6 commits into
Conversation
Adds a homeManagerModules.default flake output that exposes a programs.ambxst.settings option. Each attribute maps to a JSON file written to $XDG_CONFIG_HOME/ambxst/config/<name>.json, allowing users to declaratively configure any ambxst module (bar, theme, compositor, dock, etc.) from their Nix config. Closes Axenide#172
Switch from home.file to xdg.configFile so we can use the onChange hook to run `ambxst reload` whenever a managed config file changes. The reload is guarded by a PID check so it only fires when ambxst is actually running.
ambxst reload may not be in PATH inside the systemd service environment that runs HM activation. Adding || true ensures a failed reload never aborts the build.
|
Some Notes: Would love to hear your thoughts about is PR :-) |
Pass the flake's ambxst package via _module.args so home.nix can use lib.getExe to get the correct store path. This fixes the reload failing silently because ambxst was not in PATH during HM activation.
|
Seems like a good pull request, especially for homemanager. |
|
Would love your help @Axenide |
|
Hi, I'm gonna switch to NixOS soon so I'll be able to test this properly. :) What do y'all think? Since you are more experienced than me on Nix for sure. |
|
Currently if you configure In that case the user have 3 choices: The none declarative approach:
The declarative approaches:
programs.ambxst.settings.bar = builtins.toJSON ./bar.json
My OpinionIf someone is using NixOS you can 100% assume this person knows what he is doing. |
|
Thank you very much. I have to fix some things before this but I'll sure work on it soon, maybe even today but can't promise. lol |
Summary
homeManagerModules.defaultflake output with aprograms.ambxst.settingsoptionsettingsmaps to a JSON file at$XDG_CONFIG_HOME/ambxst/config/<name>.jsonbar,theme,compositor,system,performance,weather,desktop,lockscreen,prefix,dock,ai,workspaces,notch,overviewUsage
Add the module to your Home Manager config:
Notes
ai,weather) are untouched and remain editable via the GUI.builtins.toJSONhandles all JSON-compatible Nix values: nested attrsets, lists, strings, numbers, booleans, and null.Closes #172