XMonad: Difference between revisions

imported>Jooooscha
m Replace dead link with link to arch wiki (WM is a non specific topic, I guess thats ok)
imported>Jooooscha
Add information on how to import external modules that are not in xmonad-contrib
Line 9: Line 9:
The simplest way to install Xmonad is to activate the corresponding NixOS module.
The simplest way to install Xmonad is to activate the corresponding NixOS module.
You can do this by adding the following to your NixOS configuration.
You can do this by adding the following to your NixOS configuration.
You probably also want to activate the <core>enableContribAndExtras</code> option.
You probably also want to activate the <code>enableContribAndExtras</code> option.


   services.xserver.windowManager.xmonad = {
   services.xserver.windowManager.xmonad = {
Line 18: Line 18:
The second options automatically adds the <code>xmonad-contrib</code> and <code>xmonad-extras</code> packages.
The second options automatically adds the <code>xmonad-contrib</code> and <code>xmonad-extras</code> packages.
They are required to use the [https://hackage.haskell.org/package/xmonad-contrib Xmonad Contrib] extensions.
They are required to use the [https://hackage.haskell.org/package/xmonad-contrib Xmonad Contrib] extensions.
To add Haskell modules that are not included in the Xmonad-Contrib package, you have to tell ghc where to find them.
For example, you can use the following to add the [https://github.com/Procrat/xmonad-contexts|xmonad-contexts] module.
<syntaxHighlight lang="nix">
{ xmonad-contexts, ... }:
{
...
  services.xserver.windowManager.xmonad = {
    ...
    ghcArgs = [
      "-hidir /tmp" # place interface files in /tmp, otherwise ghc tries to write them to the nix store
      "-odir /tmp" # place object files in /tmp, otherwise ghc tries to write them to the nix store
      "-i${xmonad-contexts}" # tell ghc to search in the respective nix store path for the module
    ];
  };
}
</syntaxHighlight>
Don't forget to add the module to your inputs:
<syntaxHighlight lang="nix">
inputs.xmonad-contexts = {
  url = "github:Procrat/xmonad-contexts";
  flake = false;
};
</syntaxHighlight>


== Configuration ==
== Configuration ==
Line 23: Line 50:
To configure Xmonad you give Nix your config file like this:
To configure Xmonad you give Nix your config file like this:


services.xserver.windowManager.xmonad.config = builtins.readFile ../path/to/xmonad.hs;
<syntaxHighlight lang="nix">
services.xserver.windowManager.xmonad.config = builtins.readFile ../path/to/xmonad.hs;
</syntaxHighlight>


More information on how to configure Xmonad can be found in the [https://wiki.archlinux.org/title/Xmonad Arch Wiki], and a list of starter configs can be found in the [https://wiki.haskell.org/Xmonad/Config_archive Xmonad Config Archive].
More information on how to configure Xmonad can be found in the [https://wiki.archlinux.org/title/Xmonad Arch Wiki], and a list of starter configs can be found in the [https://wiki.haskell.org/Xmonad/Config_archive Xmonad Config Archive].