title: XMonad on Nix - cannot find xmonad-contrib
body: <p>I am trying to use nix on ubuntu, with XMonad as my window manager.
  I have this working well on one host using nixOS, but I have a second device that isn't yet ready for nixOS.  nix on top of Ubuntu is mostly working well there, but xmonad cannot find contributory libraries.</p>
  
  <p>The relevant packages are installed:</p>
  
  <pre><code>$ nix-env -q | grep xmonad
  xmonad-0.13
  xmonad-contrib-0.13
  xmonad-extras-0.12.1
  </code></pre>
  
  <p>But recompiling my xmonad.hs, it cannot find the contrib libs:</p>
  
  <pre><code>$ xmonad --recompile
  Error detected while loading xmonad configuration file: /home/martyn/.xmonad/xmonad.hs
  
  xmonad.hs:32:1: error:
  Failed to load interface for ‘XMonad.Layout.NoBorders’
  Use -v to see a list of the files searched for.
  
  ...
  
  Please check the file for errors.
  </code></pre>
  
  <p>The relevant files are installed:</p>
  
  <pre><code>$ ls /nix/store/*xmonad-contrib*/lib/**/NoBorders*
  /nix/store/4xrrwsm6362xkn9jn1b17kd891kv9z3a-xmonad-contrib-0.13/lib/ghc-8.0.2/xmonad-contrib-0.13/XMonad/Actions/NoBorders.dyn_hi
  /nix/store/4xrrwsm6362xkn9jn1b17kd891kv9z3a-xmonad-contrib-0.13/lib/ghc-8.0.2/xmonad-contrib-0.13/XMonad/Actions/NoBorders.hi
  /nix/store/4xrrwsm6362xkn9jn1b17kd891kv9z3a-xmonad-contrib-0.13/lib/ghc-8.0.2/xmonad-contrib-0.13/XMonad/Layout/NoBorders.dyn_hi
  /nix/store/4xrrwsm6362xkn9jn1b17kd891kv9z3a-xmonad-contrib-0.13/lib/ghc-8.0.2/xmonad-contrib-0.13/XMonad/Layout/NoBorders.hi
  </code></pre>
  
  <p>By adding xmonad-contrib to my nixpkgs config.nix, I have gotten these libs added to the ghc package registry:</p>
  
  <pre><code>$ cat ~/.config/nixpkgs/config.nix 
  with (import &lt;nixpkgs&gt; {});
  {
    packageOverrides = pkgs: with pkgs; {
  
      myHaskellEnv = pkgs.haskellPackages.ghcWithPackages (haskellPackages: with haskellPackages; [ xmonad-contrib ]);
    };
  }
  $ nix-env -iA nixpkgs.myHaskellEnv
  $ ghc-pkg list | grep xmonad
    xmonad-0.13
    xmonad-contrib-0.13
  $
  </code></pre>
  
  <p>with this, this ghc(i) works well:</p>
  
  <pre><code>$ /nix/store/7mkxsq7ydqcgnjbs59v1v47wfxpwrav5-ghc-8.0.2-with-packages/bin/ghc ~/.xmonad/xmonad.hs
  [1 of 1] Compiling Main             ( /home/martyn/.xmonad/xmonad.hs, /home/martyn/.xmonad/xmonad.o ) [flags changed]
  Linking /home/martyn/.xmonad/xmonad ...
  </code></pre>
  
  <p>But even the version of xmonad in that dir cannot find the libs:</p>
  
  <pre><code>$ /nix/store/7mkxsq7ydqcgnjbs59v1v47wfxpwrav5-ghc-8.0.2-with-packages/bin/xmonad --recompile
  Error detected while loading xmonad configuration file: /home/martyn/.xmonad/xmonad.hs
  
  xmonad.hs:32:1: error:
    Failed to load interface for ‘XMonad.Layout.NoBorders’
    Use -v to see a list of the files searched for.
  </code></pre>
  
  <p>I can work around this by compiling using the ghc as above, and moving the output by hand to ~/.xmonad/xmonad-x86_64-linux, and running that.  But this is a wee bit hacky, and surely shouldn't be necessary?</p>