我有一个新的NixOS安装,我想使用我的自定义XMonad配置。但是,我得到了以下错误:
$ xmonad --recompile
XMonad will use ghc to recompile, because "/home/amy/.xmonad/build" does not exist.
Error detected while loading xmonad configuration file: /home/amy/.xmonad/xmonad.hs
xmonad.hs:1:1: error:
Could not find module ‘XMonad’
Use -v to see a list of the files searched for.
|
1 | import XMonad
| ^^^^^^^^^^^^^下面是我的configuration.nix的相关部分:
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
bash
dmenu2
dzen2
emacs
firefox
gitAndTools.gitFull
haskellPackages.xmonad
haskellPackages.xmonad-contrib
haskellPackages.xmonad-extras
gcc
ghc
stack
x11
xmonad-with-packages
xorg.libX11
xsel
wget
];
. . .
services.xserver = {
enable = true;
layout = "ie";
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
extraPackages = haskellPackages: [
haskellPackages.xmonad
haskellPackages.xmonad-contrib
haskellPackages.xmonad-extras
];
};
};
# windowManager.default = "xmonad";我读过NixOS初学者: NixOS 14.04中的xmonad和haskellmode,但windowManager.xmonad.enableContribAndExtras = true;已经在我的configuration.nix里了。
编辑:只是为了澄清,我在NixOS上,但我没有使用Nix来构建我的XMonad配置。我是用普通的XMonad方式做的:我有一个.xmonad目录,配置在xmonad.hs中,我正在运行xmonad --recompile来构建它。
编辑:当我寻找相关的包作为根时,我会找到它们。
# nix-env -q
xmonad-0.14.2
xmonad-contrib-0.14
xmonad-extras-0.14但作为普通用户,以下命令不返回任何内容。
$ nix-env -q如何使这些包对非根帐户可见?
编辑:奇怪的是,当我重新启动时,XMonad神奇地工作,编译我的配置没有问题。我不知道为什么重新启动有帮助,因为我已经做了几次nixos-重建开关。
发布于 2021-08-30 09:43:50
我知道这是旧的,但是这个搜索总是出现在顶部
之所以会发生这种情况,是因为您安装了xmonad两次。
首先是xmonad,而不知道环境中的其他包(这就是nix的全部目的,记住,构建隔离的和可复制的环境)
environment.systemPackages = with pkgs; [
...
haskellPackages.xmonad
...
];第二个是通过启用服务来安装的,在服务配置文件上称为香草 A.K.A xmonad-with-packages:
services.xserver = {
windowManager.xmonad = {
enable = true;
};
};xmonad带包实际上是一个设置所需环境变量的包装脚本,以便xmonad可以看到您添加的extraPackages。
TLDR:
xmonad二进制文件。xmonad --recompile时,第一个是运行的,没有运气xmonad时,它实际上是从xmonad-with-packages (加上您的extraPackages)运行vanilla二进制文件(参见下面的代码和链接在这里) 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商店:
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.https://stackoverflow.com/questions/53431408
复制相似问题