问题
I'm trying so set up a NixOS VM for code development in haskell, and got into troubles with the basic installation of both xmonad and emacs. The relevant part of my /etc/nixos/configuration.nix
is
environment.systemPackages = with pkgs; [
emacs
emacs24Packages.haskellMode
xlibs.xmessage
haskellPackages.haskellPlatform.ghc
haskellPackages.xmobar
haskellPackages.xmonad
haskellPackages.xmonadContrib
haskellPackages.xmonadExtras
];
xmonad: when I try to compile the code, xmonad complains that it couldn't find the module XMonad.Util.EZConfig. Compiling
xmonad.hs
with ghc is ok, and I'm also able to load the module into ghci. On the #nixos channel, I was told to use the function ghcWithPackages, but I wasn't able to correct the problem. Moreover, I'd like to understand why there is this problem in the first place, as it seems to me that this is a very simple use case. A minimalxmonad.hs
with which I have the problem is:import XMonad import XMonad.Util.EZConfig main = xmonad $ defaultConfig { modMask = mod4Mask , terminal = "konsole" } `additionalKeysP` [ ("M-e", spawn "emacs") , ("M-f", spawn "firefox") ]
emacs: after the installation of the package haskellmode (look at the configuration.nix above), I'm not able to enter haskell-mode in emacs.
I put together these problems as I suspect they're both caused by a fundamental incomprehension of something on my behalf, so the cause may be common.
回答1:
just add
windowManager.xmonad.enableContribAndExtras = true;
to
/etc/nixos/configuration.nix
Then start xmonad the usual way through your .xsession file
回答2:
I can't add comment for now... But I think it's a problem with cabal local and global repositories.
As I see, "Nix allows users to install packages without requiring root privileges, and provides each user with its own view of the set of installed packages. Multiple versions of a program or library can be installed at the same time. Package upgrades are atomic and can be rolled back."
Maybe you can use ghc-pkg list
to see if, in root and normal user, the packages are well installed.
来源:https://stackoverflow.com/questions/23740373/nixos-beginner-xmonad-and-haskellmode-in-nixos-14-04