I know this is old but this search keep appearing on tops
The reason why this happens is because you installed xmonad twice
First one is just xmonad without any knowledge of other packages on your environment (that's the whole purpose of nix, remember, building isolated and reproducible environments)
environment.systemPackages = with pkgs; [
...
haskellPackages.xmonad
...
];
The second one is installed by enabling the service, and is called vanilla A.K.A xmonad-with-packages
on the service configuration file:
services.xserver = {
windowManager.xmonad = {
enable = true;
};
};
xmonad-with-packages is actually a wrapper script that sets the needed environment variables so that xmonad can see the extraPackages
you added
TLDR:
- Both packages output an
xmonad
binary
- First one has no access to your env
- Second one does
- When you run
xmonad --recompile
, the first one is ran, no luck
- When xserver runs
xmonad
it is actually running the vanilla
binary from xmonad-with-packages
(plus your extraPackages
) (See code below, and link here)
xmonad = if (cfg.config != null) then xmonad-config else xmonad-vanilla;
This is for nixpkgs, but i just had the same problem with home-manager
since a few days
Proof
Inspecting xmonad
which xmonad
/home/hao/.nix-profile/bin/xmonad
I know it’s in my profile…, but where?
which xmonad | xargs readlink
/nix/store/yx0kb7i209ffh20qmxpbvmllb32lq7rr-home-manager-path/bin/xmonad
Ok…, installed by home-manager
, but where is it?
which xmonad | xargs readlink | xargs readlink
/nix/store/g7f0v21jmi9smh1q1f6fw050r76nzb1p-ghc-8.10.6-with-packages/bin/xmonad
Is it really xmonad or a symlink?
file /nix/store/g7f0v21jmi9smh1q1f6fw050r76nzb1p-ghc-8.10.6-with-packages/bin/xmonad
/nix/store/g7f0v21jmi9smh1q1f6fw050r76nzb1p-ghc-8.10.6-with-packages/bin/xmonad: symbolic link to /nix/store/0lxxi3hrs49fiil29xw6gjx09ad3nf2n-xmonad-0.15/bin/xmonad
Is it really xmonad or a symlink? x2
file /nix/store/0lxxi3hrs49fiil29xw6gjx09ad3nf2n-xmonad-0.15/bin/xmonad
/nix/store/0lxxi3hrs49fiil29xw6gjx09ad3nf2n-xmonad-0.15/bin/xmonad: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/9bh3986bpragfjmr32gay8p95k91q4gy-glibc-2.33-47/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, stripped
^ Save that path, you can see it’s actually pointing to the xmonad
binary:
Now enter the monad (with packages):
nix-shell -p xmonad-with-packages
For starters, the derivation is pointing elsewhere, not to my home-environment,
but directly to the nix-store:
which xmonad
/nix/store/6n1wh9ky7ydbd2ii5877nly9xbrqz4m9-xmonad-with-packages-8.10.6/bin/xmonad
And we now see not a binary file but a bash script
file /nix/store/6n1wh9ky7ydbd2ii5877nly9xbrqz4m9-xmonad-with-packages-8.10.6/bin/xmonad
/nix/store/6n1wh9ky7ydbd2ii5877nly9xbrqz4m9-xmonad-with-packages-8.10.6/bin/xmonad: a /nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23/bin/bash -e script, ASCII text executable
And if you look at the contents, you’ll see that it's actually using the same
xmonad from above (see below, what does exec
runs), except it adds all the extraPackages
(the NIX_GHC
path) for us:
which xmonad | xargs cat
! /nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23/bin/bash -e
export NIX_GHC='/nix/store/sca07cyap7rqkxk4c7sqkvn94bsfaaiz-ghc-8.10.6-with-packages/bin/ghc'
export XMONAD_XMESSAGE='/nix/store/jg3adhj3kpqm8dcrgb95nn5c5k5z61yx-xmessage-1.0.5/bin/xmessage'
exec "/nix/store/sca07cyap7rqkxk4c7sqkvn94bsfaaiz-ghc-8.10.6-with-packages/bin/xmonad" "@"
What does exec
run?
file /nix/store/sca07cyap7rqkxk4c7sqkvn94bsfaaiz-ghc-8.10.6-with-packages/bin/xmonad
/nix/store/sca07cyap7rqkxk4c7sqkvn94bsfaaiz-ghc-8.10.6-with-packages/bin/xmonad: symbolic link to /nix/store/0lxxi3hrs49fiil29xw6gjx09ad3nf2n-xmonad-0.15/bin/xmonad
Let’s compile
xmonad --recompile
XMonad will use ghc to recompile, because "/home/hao/.xmonad/build" does not exist.
XMonad recompilation process exited with success!
But out of our safe space first
exit
Using our home-manager
derivation
xmonad --recompile 2>&1
XMonad will use ghc to recompile, because "/home/hao/.xmonad/build" does not exist.
Error detected while loading xmonad configuration file: /home/hao/.xmonad/xmonad.hs
xmonad.hs:4:1: error:
Could not find module ‘XMonad’
Perhaps you meant DsMonad (needs flag -package-key ghc-8.10.6)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
4 | import XMonad hiding (config,workspaces)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:8:1: error:
Could not find module ‘XMonad.Hooks.DynamicLog’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
8 | import XMonad.Hooks.DynamicLog
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:9:1: error:
Could not find module ‘XMonad.Hooks.ManageDocks’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
9 | import XMonad.Hooks.ManageDocks
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:10:1: error:
Could not find module ‘XMonad.StackSet’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
10 | import qualified XMonad.StackSet as W
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:11:1: error:
Could not find module ‘XMonad.ManageHook’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
11 | import XMonad.ManageHook
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:12:1: error:
Could not find module ‘XMonad.Util.NamedScratchpad’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
12 | import XMonad.Util.NamedScratchpad
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:13:1: error:
Could not find module ‘XMonad.Util.EZConfig’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
13 | import XMonad.Util.EZConfig
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:14:1: error:
Could not find module ‘XMonad.Actions.CycleWS’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
14 | import XMonad.Actions.CycleWS (shiftTo, moveTo, Direction1D(..), WSType(..))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:15:1: error:
Could not find module ‘XMonad.Actions.Commands’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
15 | import XMonad.Actions.Commands
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:16:1: error:
Could not find module ‘XMonad.Actions.ShowText’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
16 | import XMonad.Actions.ShowText
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:17:1: error:
Could not find module ‘XMonad.Layout.Fullscreen’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
17 | import XMonad.Layout.Fullscreen
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:18:1: error:
Could not find module ‘XMonad.Layout.NoBorders’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
18 | import XMonad.Layout.NoBorders
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:19:1: error:
Could not find module ‘XMonad.Hooks.ManageHelpers’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
19 | import XMonad.Hooks.ManageHelpers
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:20:1: error:
Could not find module ‘XMonad.Actions.CopyWindow’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
20 | import XMonad.Actions.CopyWindow
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:22:1: error:
Could not find module ‘XMonad.Actions.Navigation2D’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
22 | import XMonad.Actions.Navigation2D
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:23:1: error:
Could not find module ‘XMonad.Util.Run’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
23 | import XMonad.Util.Run (spawnPipe)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:24:1: error:
Could not find module ‘XMonad.Util.NamedWindows’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
24 | import XMonad.Util.NamedWindows (getName, unName)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:27:1: error:
Could not find module ‘XMonad.Util.ExtensibleState’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
27 | import qualified XMonad.Util.ExtensibleState as XS
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:28:1: error:
Could not find module ‘XMonad.Util.Timer’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
28 | import XMonad.Util.Timer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:31:1: error:
Could not find module ‘XMonad.Actions.UpdateFocus’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
31 | import XMonad.Actions.UpdateFocus
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:32:1: error:
Could not find module ‘XMonad.Layout.SimpleFloat’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
32 | import XMonad.Layout.SimpleFloat
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:33:1: error:
Could not find module ‘XMonad.Layout.PerWorkspace’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
33 | import XMonad.Layout.PerWorkspace (onWorkspace)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:34:1: error:
Could not find module ‘XMonad.Layout.Magnifier’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
34 | import XMonad.Layout.Magnifier as Mag
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:35:1: error:
Could not find module ‘XMonad.Util.Loggers’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
35 | import XMonad.Util.Loggers
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:36:1: error:
Could not find module ‘XMonad.Layout.LayoutCombinators’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
36 | import XMonad.Layout.LayoutCombinators (JumpToLayout(..))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:39:1: error:
Could not find module ‘XMonad.Actions.FloatSnap’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
39 | import XMonad.Actions.FloatSnap
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:40:1: error:
Could not find module ‘XMonad.Util.WorkspaceCompare’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
40 | import qualified XMonad.Util.WorkspaceCompare as W
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xmonad.hs:42:1: error:
Could not find module ‘XMonad.Layout.Gaps’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
42 | import XMonad.Layout.Gaps
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please check the file for errors.