Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use other hyprland "tools" which need to update hypr config folder. #7

Open
hmajid2301 opened this issue Mar 23, 2024 · 8 comments

Comments

@hmajid2301
Copy link

Hi,

Thanks for the great work on this flake/hyprland module. It has made configuring my system a lot nicer.
I was wondering if there was a way to use with some of the other hyprland tooling, such as hyprpaper or hypridle. Which require the config file to be in the ~/.config/hypr folder by default.

When I try to set up hyprpaper I get the following error.

Error installing file '.config/hypr/hyprpaper.conf' outside $HOME

This happens because I think it doesn't have permission to write to that config directory. As the entire directory is symlinked by this module? i.e. hypr -> /nix/store/10i7knfm540s6zy5g63xaik7aalr5hbj-home-manager-files/.config/hypr.

Any help would be appreciated

@spikespaz
Copy link
Member

Yes, this is an oversight, my apologies. I will avoid writing the entire hypr directory as read-only. The assumption was that if you are using this flake, you are seeking an entirely declarative config, the expectation was that you use the mechanisms provided by the Home Manager module (for example, wayland.windowManager.hyprland.configFile."hyprpaper.conf".text) to write to that directory.

@hmajid2301
Copy link
Author

No need to apologise :), that would be great.

Also, just to clarify I am using the hyprpaper flake home-manager module in my example above. It is trying to write and failing to, causing an error https://github.com/hyprwm/hyprpaper/blob/main/nix/hm-module.nix#L66.

Thanks, as I say I prefer using this flake, to define my config in a more nix way.

@spikespaz
Copy link
Member

Could you please try to set xdg.configFile."hypr".recursive = true?

@spikespaz
Copy link
Member

spikespaz commented Mar 23, 2024

There is a new branch if that option does not work or is unsatisfactory, revert-managed-config-dir. This branch reverts three commits that introduced a custom configFile attribute, very similar to xdg.configFile.

I did foresee this becoming a problem.

Documentation for the option wayland.windowManager.hyprland.configFile with type types.attrsOf (configFile pkgs "${config.xdg.configHome}/hypr"):

Configuration files and directories to link in the Hyprland config directory.
This is an attribute set of file descriptions similar to
{option}xdg.configFile, except relative to {path}$XDG_CONFIG_HOME/hypr.

If necessary, you may set {option}xdg.configFile."hypr".recursive = true.

To elaborate: I suggested this in the doc because I wanted users to be able to create and edit files within that directory (and allow external programs to do so, such as plugins with state). I am not sure if multiple entries for xdg.configFile."hypr" will work when recursive = true, but I'd like to see you try, and then if it doesn't work, use the branch I mentioned.

@spikespaz
Copy link
Member

The branch reintroduces a bug that the config would have to be reloaded once for each file that was modified by the Nix config. For now, this is keybinds.conf and hyprland.conf. In some cases (IIRC) a change can cause both files to be modified, causing a double-reload, usually because a store path has changed. I don't remember what exactly caused this, but I tried to mitigate it by using an absolute path to keybinds.conf from a source line in hyprland.conf.

@hmajid2301
Copy link
Author

i will update you when i have some time to try this! 🙏 thank you so much.

@hmajid2301
Copy link
Author

Sorry for the late reply,

I was able to get this working with xdg.configFile."hypr".recursive = true. I did have to turn off my hyprland config first in home-manager so the symlink was deleted (went to gnome) then switched the config back on (enabled it).

eza -al ~/.config/hypr
lrwxrwxrwx - haseeb  2 Apr 19:53 hyprland.conf -> /nix/store/snwq2gy6x2jhgwsm6a78jc3vdaqqad3w-home-manager-files/.config/hypr/hyprland.conf
lrwxrwxrwx - haseeb  2 Apr 19:53 hyprpaper.conf -> /nix/store/snwq2gy6x2jhgwsm6a78jc3vdaqqad3w-home-manager-files/.config/hypr/hyprpaper.conf
lrwxrwxrwx - haseeb  2 Apr 19:53 keybinds.conf -> /nix/store/snwq2gy6x2jhgwsm6a78jc3vdaqqad3w-home-manager-files/.config/hypr/keybinds.conf

Thanks a ton!

@spikespaz spikespaz reopened this Apr 3, 2024
@spikespaz
Copy link
Member

If you or anyone else has any problems relating to this, I want discussion to be immediately visible. No fix has been merged into master.

I am still not satisfied, as I myself have not confirmed if Home Manager will merge multiple configFile entries when recursive = true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants