Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NixOS beginner: xmonad and haskellmode in NixOS 14.04

Tags:

nixos

xmonad

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.

like image 282
meditans Avatar asked May 19 '14 14:05

meditans


2 Answers

just add

    windowManager.xmonad.enableContribAndExtras = true;

to

    /etc/nixos/configuration.nix

Then start xmonad the usual way through your .xsession file

like image 195
rmoro Avatar answered Sep 28 '22 17:09

rmoro


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.

like image 26
grwp Avatar answered Sep 28 '22 15:09

grwp