Bspwm won't read config file

I installed NixOS yesterday and so far I really like it. I have one big problem though and that is related to bspwm and sxhkd.

bspwm starts up and I can open terminals and stuff like that, but it seems like bspwm doesn’t read the config file.

I can’t change workspace, nothing happens. Nothing in my bspwm config is acutally set on boot. I tried this by changing the split ratio which had no effect at all.

As I understand from the NixOS options page is that i really don’t need to specify the config path if it’s in ~/.config/bspwm/bspwmrc. I’ve tried both to specify the path and completely remove it from the configuration.nix, same issue no matter what.

I tried to run bspc in terminal and got the following:

~ → bspc
No arguments given.

When I try to swap desktop:

~ → bspc desktop -f 2
desktop -f: Invalid descriptor found in '2'.

I did search the forum and some people have had the same problem and it seems like most solving this by using home-manager. I don’t want to do that, yet at least. I want to learn a bit of how Nix works first.

Right now my configuration.nix looks like this:

services.xserver = {
  enable = true;
  xkb.layout = "se";
  displayManager.defaultSessiopn = "none+bspwm";
  windowManager.bspwm = {
    enable = true;
    configFile = "/home/user/.config/bspwm/bspwmrc";
    sxhkd.configFile = "/home/user/.config/sxhkd/sxhkdrc";

Hey, welcome to NixOS discourse!

Quick question: is your user called user or something else?

The documentation for the option configFile says this: “Path to the bspwm configuration file. If null, $HOME/.config/bspwm/bspwmrc will be used.”

So yes, technically you can just leave this blank, it will default to null and read bspwmrc from your user’s home directory.

No, I changed that for the post only, it’s the right user name in the config file. This doesn’t seems to work for me at all though, no matter if I put the path or leave it out. I also tried with ~/ and windowManager.bspwm.configFile = builtins.getEnv "HOME" + "/.config/bspwm/bspwmrc";.

So if you just do

  windowManager.bspwm = {
    enable = true;

That doesn’t work? Because reading the docstring, I feel it should work.

Nope, that doesn’t work. I thought that it would work since the options page say it should, that’s why I’m so confused about this.

Make sure the Shebang in bspwmrc is correct and works on NixOS.


That’s awkward. I didn’t think about that. Swapped out bash to sh, now it seems to work fine :slight_smile:

Yeah I remembered I had this problem when I started with NixOS many years ago.