Dwm

From NixOS Wiki
Revision as of 10:04, 18 November 2021 by Sikmir (talk | contribs) (Fix typos)
Jump to: navigation, search

dwm is a window manager made by the suckless team

Installation

Installation is simple when using an xserver. In your configuration.nix just enable dwm like this:

services.xserver.windowManager.dwm.enable = true;


Creating overlay

To apply patches, and modify config file, you have to create an overlay for dwm which will be used to override config files and applying patches. This can be done like the following

nixpkgs.overlays = [
  (self: super: {
    dwm = super.dwm.overrideAttrs (oldAttrs: rec {
      # ...
    });
  })
];

Configuration

Missing. For now, refer to st, this explains how to modify config st, you have to do it in a similar way for dwm, but you have to use the overlay instead of the way it is done for st.

Patching

Patches can be applied by using the patches array:

nixpkgs.overlays = [
  (self: super: {
    dwm = super.dwm.overrideAttrs (oldAttrs: rec {
      patches = [
        #Your patches here
      ];
    });
  })
];

Patches can be applied in different ways and in combination with each other

Patches using local files

patches can be installed by just giving the path to a local diff files. for example:

nixpkgs.overlays = [
  (self: super: {
    dwn = super.dwm.overrideAttrs (oldAttrs: rec {
      patches = [
        ./path/to/local.diff
      ]
    })
  })
];

patches using fetchpatch

If you want to use fetchpatch you need to obtain the hash for the patch you want to apply .

To obtain the hash of a patch you need to run the command nix-prefetch-url <url> for example:

$ nix-prefetch-url https://dwm.suckless.org/patches/steam/dwm-steam-6.2.diff

This will output the hash that you need.

In your patches array you can then apply the patch in the following way using fetchpatch

nixpkgs.overlays = [
  (self: super: {
    dwm = super.dwm.overrideAttrs (oldAttrs: rec {
      patches = [
        (super.fetchpatch {
          url = "https://dwm.suckless.org/patches/steam/dwm-steam-6.2.diff";
          sha256 = "1ld1z3fh6p5f8gr62zknx3axsinraayzxw3rz1qwg73mx2zk5y1f";
        })
      ];
    });
  })
];

Using Custom Builds

If you want to use an existing config of DWM you can create a custom local nix overlay

 nixpkgs.overlays = [
    (final: prev: {
      dwm = prev.dwm.overrideAttrs (old: { src = /path/to/dwm ;});
    })
];

This will make sure it will rebuild your suckless build when nix is rebuilt.

Note: nix will only rebuild DWM if there are changes to the files.

The same thing can be done with other suckless programs like ST and DMenu

See also

st