I’m using Home Manager and hyprland and I’ve decided that I want a button that will switch between two different hyprconfigs, I know this works for hyprland instantly without the need for rebuilding as long as you have those configs, but I don’t know how to make both of them declaratively.
one is easy enough especially with home manager, and I can see how to do two if I knew how to make a new general file in nixos declaratively, but idk how to do that.
also, if possible it would be nice to do both within my hyprland home manager config, but I can live without that if needed.
I do not know the config about hyprland, but I have some general ideas.
Maybe declare both config files in different name, i.e. hyprconfigA, hyprconfigB in home manager
And you manually make a script to symlink either of them when you run it, like ln -s /home/user/.config/someprogram/hyprconfigA /home/user/.config/someprogram/hyprconfig, something like that.
looking at the link, this would create a separate config for every user, but not a different config. though I would assume such a thing should be possible. I’ll look into it and try to find some better documentation.
this is really close to what I want, but sadly it doesn’t quite work, it doesn’t change hyprland’s config, it opens a new instance of hyprland with that config.
I’m trying to find out how to get hyprland to use a preset config, but the only solution I’m seeing so far is copy/pasting a config into the hyprconfig folder and renaming it which doesn’t work because nixos, symlinks and read-only file systems.
thank you for your help though. this approach would work if it werent for how hyprland worked.
But this is also easy enough with nix right? don’t have nix create the config file. Have it create two files in the store, and then make a script does the (re)linking in the config directory.
you could then use systemd-tmpfiles to make sure config1 was linked in place on activation. Install switcher into your packages. I’m sure I’ve typo’d at least one thing, but you get the idea?
it almost worked. when running the switch command I get an error. ln: failed to create symbolic link '/home/MatsuNoKi/.config/hyper/hyprland.conf': No such file or directory
also, -o didn’t work at first. took me a while to realize what it was but replacing it with || worked.