NixOS beginner: xmonad and haskellmode in NixOS 14.04

╄→гoц情女王★ 提交于 2019-12-23 10:02:32

问题


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 minimal xmonad.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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!