Difference between revisions of "Dwm"

From NixOS Wiki
Jump to: navigation, search
(replace overlays with override, deduplicate info)
m (rollback unauthorized mass edits)
Tag: Rollback
 
(8 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
== Installation ==
 
== Installation ==
  
Enable <code>dwm</dwm> in your system configuration:
+
Enable <code>dwm</code> in your system configuration:
  
 
<syntaxhighlight lang="nix">
 
<syntaxhighlight lang="nix">
Line 10: Line 10:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
== Creating an override ==
 +
=== Patching dwm ===
  
== Creating override ==
+
To patch dwm, override <code>services.xserver.windowManager.dwm.package</code> as below:
 
 
To patch dwm, override `services.xserver.windowManager.dwm.package` as below:
 
  
 
<syntaxhighlight lang="nix">
 
<syntaxhighlight lang="nix">
services.xserver.windowManager.dwm.package = pkgs.dwm.overrideAttrs (oldAttrs: rec {
+
services.xserver.windowManager.dwm.package = pkgs.dwm.override {
 
   patches = [
 
   patches = [
 
     # for local patch files, replace with relative path to patch file
 
     # for local patch files, replace with relative path to patch file
Line 24: Line 24:
 
       # replace with actual URL
 
       # replace with actual URL
 
       url = "https://dwm.suckless.org/patches/path/to/patch.diff";
 
       url = "https://dwm.suckless.org/patches/path/to/patch.diff";
       # replace hash with the value from `nix-prefetch-url "https://dwm.suckless.org/patches/path/to/patch.diff"`
+
       # replace hash with the value from `nix-prefetch-url "https://dwm.suckless.org/patches/path/to/patch.diff" | xargs nix hash to-sri --type sha256`
 +
      # or just leave it blank, rebuild, and use the hash value from the error
 
       hash = "";
 
       hash = "";
 
     })
 
     })
 
   ];
 
   ];
})
+
};
 +
</syntaxhighlight>
 +
 
 +
=== Using custom sources ===
 +
 
 +
If you have a locally stored source tree for dwm with changes already applied, you can use that instead:
 +
 
 +
<syntaxhighlight lang="nix">
 +
services.xserver.windowManager.dwm.package = pkgs.dwm.overrideAttrs {
 +
  src = ./path/to/dwm/source/tree;
 +
};
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Alternatively, you can set <code>src</code> to [https://nixos.org/manual/nixpkgs/stable/#chap-pkgs-fetchers the output of a fetcher], if you have the source tree stored online.
 +
 +
== Troubleshooting ==
 +
 +
If your change does not appear to take effect:
 +
 +
* You must '''not''' have <code>dwm</code> listed anywhere in your <code>environment.systemPackages</code> or <code>home.packages</code>.
 +
* Remove any packages installed via <code>nix-env</code> or <code>nix profile</code>.
 +
* After rebuilding and switching, reboot and check again.
  
 
== See also ==
 
== See also ==
[https://nixos.wiki/wiki/St st]
+
* [https://nixos.wiki/wiki/St st]
 
+
* [https://tools.suckless.org/dmenu/ DMenu]
[https://tools.suckless.org/dmenu/ DMenu]
 
  
 
[[Category:Window managers]]
 
[[Category:Window managers]]
 
[[Category:Applications]]
 
[[Category:Applications]]

Latest revision as of 11:03, 6 April 2024

dwm is a window manager made by the suckless team.

Installation

Enable dwm in your system configuration:

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

Creating an override

Patching dwm

To patch dwm, override services.xserver.windowManager.dwm.package as below:

services.xserver.windowManager.dwm.package = pkgs.dwm.override {
  patches = [
    # for local patch files, replace with relative path to patch file
    ./path/to/local.patch
    # for external patches
    (pkgs.fetchpatch {
      # replace with actual URL
      url = "https://dwm.suckless.org/patches/path/to/patch.diff";
      # replace hash with the value from `nix-prefetch-url "https://dwm.suckless.org/patches/path/to/patch.diff" | xargs nix hash to-sri --type sha256`
      # or just leave it blank, rebuild, and use the hash value from the error
      hash = "";
    })
  ];
};

Using custom sources

If you have a locally stored source tree for dwm with changes already applied, you can use that instead:

services.xserver.windowManager.dwm.package = pkgs.dwm.overrideAttrs {
  src = ./path/to/dwm/source/tree;
};

Alternatively, you can set src to the output of a fetcher, if you have the source tree stored online.

Troubleshooting

If your change does not appear to take effect:

  • You must not have dwm listed anywhere in your environment.systemPackages or home.packages.
  • Remove any packages installed via nix-env or nix profile.
  • After rebuilding and switching, reboot and check again.

See also