我知道这是旧的,但这个搜索一直出现在顶部
出现这种情况的原因是因为你安装了两次 xmonad
第一个只是 xmonad,不知道您环境中的其他包(这是 nix 的全部目的,记住,构建隔离 和可重现的环境)
environment.systemPackages = with pkgs; [
...
haskellPackages.xmonad
...
];
第二个是通过启用服务安装的,在服务配置文件中称为vanilla A.K.A xmonad-with-packages:
services.xserver = {
windowManager.xmonad = {
enable = true;
};
};
xmonad-with-packages实际上是一个wrapper script,它设置了所需的环境变量,以便xmonad可以看到你添加的extraPackages
TLDR:
- 两个包都输出
xmonad二进制
- 第一个无法访问您的环境
- 第二个
- 当你运行
xmonad --recompile时,第一个运行,没有运气
- 当 xserver 运行
xmonad 时,它实际上是在运行来自 xmonad-with-packages 的 vanilla 二进制文件(加上您的 extraPackages)(参见下面的代码和 link here)
xmonad = if (cfg.config != null) then xmonad-config else xmonad-vanilla;
这是为 nixpkgs 准备的,但我几天前就遇到了与 home-manager 相同的问题
证明
检查xmonad
which xmonad
/home/hao/.nix-profile/bin/xmonad
我知道它在我的个人资料中……但是在哪里?
which xmonad | xargs readlink
/nix/store/yx0kb7i209ffh20qmxpbvmllb32lq7rr-home-manager-path/bin/xmonad
好的...,由home-manager 安装,但它在哪里?
which xmonad | xargs readlink | xargs readlink
/nix/store/g7f0v21jmi9smh1q1f6fw050r76nzb1p-ghc-8.10.6-with-packages/bin/xmonad
它真的是 xmonad 还是符号链接?
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
它真的是 xmonad 还是符号链接? 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
^ 保存那个路径,你可以看到它实际上指向了xmonad 二进制文件:
现在输入 monad(带有包):
nix-shell -p xmonad-with-packages
首先,推导指向其他地方,而不是我的家庭环境,
但直接到nix-store:
which xmonad
/nix/store/6n1wh9ky7ydbd2ii5877nly9xbrqz4m9-xmonad-with-packages-8.10.6/bin/xmonad
我们现在看到的不是二进制文件而是 bash 脚本
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
如果你看一下内容,你会发现它实际上使用的是相同的
上面的 xmonad(见下文,exec 运行什么),除了它为我们添加了所有 extraPackages(NIX_GHC 路径):
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" "@"
exec 运行什么?
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
让我们编译
xmonad --recompile
XMonad will use ghc to recompile, because "/home/hao/.xmonad/build" does not exist.
XMonad recompilation process exited with success!
但首先要离开我们的安全空间
exit
使用我们的home-manager 推导
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.