Sway config with home manager

Hi all.

Previously I had sway enabled only in system/configuration.nix and then wrote my sway config by hand.
I was hoping to move to the sway config to be managed by home-manager.

BTW, this wiki page (Sway - NixOS Wiki ) says:
" Note that if you enable Sway using NixOS (via programs.sway.enable = true; in configuration.nix), your Home Manager configurations for Sway will be ignored."
I think this is no longer the case because a sway config does get generated if I have it enabled in home-manager, even if programs.sway.enable is set in configuration.nix

On to my actual problem, after porting my config to home manager, the config file seem almost identical to the old one. The order in the config file is a bit different though, so it’s hard to compare.
However, when I start flameshot, the icon appears in the status bar for a few seconds and then something goes wrong and it is replaced by an red sad face emoticon.
red_angry

When starting swaybar manually in the error state and add the -d option:

[common/background-image.c:130] Failed to load background image (Couldn’t recognize the image file format for file “/etc/profiles/per-user/pico/share/icons/hicolor/scalable/apps/flameshot.svg”).

In case it’s useful, here is the sway config generated by home-manager (the one with the issue)

And here is the one that gives no issue

To be honest I don’t think it’s related to the config that generated, because I even tried to delete the home-manager config and replace it with my own, and the problem persists.

Any help on this issue would be much appreciated.
Pico

I don’t think that was ever the case (home-manager doesn’t introspect NixOS config, home-manager profiles take precedence in $PATH, and as you say config is generated anyway), the wiki is often wrong.

Yeah, sounds more like sway is being built without support for .svg files as icons in swaybar. Presumably you’re enabling home-manager’s sway option to actually install sway, and for whatever reason that results in you running a subtly different sway than before (maybe you’re using unstable, or the NixOS module overrides some options that the home-manager one doesn’t).

If you set package to null, the home-manager sway module will still do all of its config generation and systemd user unit stuff, but it will not separately add sway to your user profile. This is probably what you want on NixOS for various reasons.

1 Like

If you set package to null, the home-manager sway module will still do all of its config generation and systemd user unit stuff, but it will not separately add sway to your user profile. This is probably what you want on NixOS for various reasons.

It works! :grinning:
Thanks for your help @TLATER
I was stuck on that for longer than I care to admit.