A recent release of the window manager, xmonad, was added to nixpkgs. The haskellPackage is called ’ xmonad_0_17_0’. There is also a popular companion package that was updated, called ‘xmonad-contrib_0_17_0’. The problem is I am not sure how to configure my NixOS system to use the new version instead of the vanilla ‘xmonad’. As for the time being, I am using the vanilla version of xmonad (0.15.0) and the ‘xmonad-contrib’ without issue.
Some of the things I tried:
Using home-manager, I tried to to reference the updated companion package, hoping it would magically pull in the updated xmonad. The relevant section of my home-manager configuration is:
This resulted in the error stating that I do not have the correct dependency version:
Setup: Encountered missing or private dependencies:
xmonad >=0.16.99999 && <0.18
I also attempted to make an overlay, thinking that I can somehow mask the vanilla ‘xmonad’ package with the new one. So I put this in my home-manager config:
This did not change the error or outcome in any way.
I am new to nix/NixOS, so I am not sure how to correctly leverage the overlay system or the home-manager module to inject the new version of xmonad. I am also willing to move the xmonad out of home-manager and into the system NixOS module if that is what it takes to upgrade.
and unfortunately I got a similar error. Without the _0_17_0, everything works just fine. I would expect the changes I made to work, so I think there’s a problem. I see that someone just posted a workaround on Xmonad is out of date · Issue #145730 · NixOS/nixpkgs · GitHub, but I haven’t tried it yet.
Preprocessing library for xmonad-extras-0.17.0..
Using Parsec parser
Configuring xmonad-contrib-0.17.0...
CallStack (from HasCallStack):
$, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:1024:20 in Cabal-3.2.1.0:Distribution.Simple.Configure
configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:477:12 in Cabal-3.2.1.0:Distribution.Simple.Configure
configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:625:20 in Cabal-3.2.1.0:Distribution.Simple
confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:65:5 in Cabal-3.2.1.0:Distribution.Simple.UserHooks
configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:180:19 in Cabal-3.2.1.0:Distribution.Simple
defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:116:27 in Cabal-3.2.1.0:Distribution.Simple
defaultMain, called at Setup.lhs:3:10 in main:Main
Setup: Encountered missing or private dependencies:
xmonad >=0.16.99999 && <0.18
error: builder for '/nix/store/n0fy67liark5i3gfps1ws7qfn5wabjf6-xmonad-contrib-0.17.0.drv' failed with exit code 1
error (ignored): error: cannot unlink '/tmp/nix-build-xmonad-extras-0.17.0.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/y22g17g7gyf6ar6gj258vbf6fzbwh5fh-ghc-8.10.7-with-packages.drv' failed to build
error: 1 dependencies of derivation '/nix/store/39v6f7hgnixpqgk2vv1z718rdng8m70g-xmonad-with-packages-8.10.7.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wdcq0v7iw70gz6z137lpny4rbhv89w9y-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/85gh1m8q5c0ymyc5697s5pramay22hij-xsession.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3nzrvlvga65fd8qwf612sj6b63zp8mfp-nixos-system-wombat11k-21.11pre332033.715f6341195.drv' failed to build
xmonad-contrib_0_17_0 and xmonad-extras_0_17_0 currently don’t work in nixpkgs, but should be fixed in a few days or so.
Still, your approach with extraPackages won’t work, I’m pretty sure. As the name indicates, this is intended to add extra packages to the build environment for an XMonad configuration and the xmonad package itself will be added unconditionally, so with your configuration snippet, conflicting xmonad versions would be included likely causing some kind of trouble.
The module will need to be changed to make it easier changing the xmonad package used (i. e. without an overlay). For now using an overlay is the only robust solution, is my estimate.
Thanks for the responses. I think I will wait until the module in NixOS or home-manager is modified to accommodate. The reason being is that even with the following overlays, I get further along but there is an xmonad configuration compilation issue that the home-manager xmonad module may have to take into account.
XMonad will use ghc to recompile, because neither “/build/xmonad-config/build” nor “/build/xmonad-config/stack.yaml” exists.
XMonad recompiling (forced).
xmonad: ghc: runProc: exec: does not exist (No such file or directory)
I will revisit this once Stackage adds the new xmonad version into LTS as the github issue mentioned.
Indeed, seems like the newer xmonad attribute is not patched to know about NIX_GHC which is used by the xmonad wrapper. This patch currently lives at pkgs/development/haskell-modules/patches/xmonad-nix.patch in nixpkgs.
There is nothing to change (1) in the NixOS/home-manager module. The reason it doesn’t work is that it relies on behaviour that gets patched into the xmonad derivation in nixpkgs, which is missing when you use xmonad_0_17_0/an upstream version.
(1): Ok, this is not entirely true, seeing as they changed the output location of the recompile binary upstream, but my point still stands.
would be expected to work fine. This still leaves some convenience to be desired, but I’d leave improving this to the NixOS modules’ authors, since I’m not involved with that at all (and don’t even use XMonad for that matter).
I am now running the latest version of xmonad using home-manager after the PRs mentioned in this thread were merged. Thank you everyone for your support here.
How does one patch, I am struggling to get .17 working as well. Trying to transition from arch and move my configs over. Would be great if there was a way to build with stack
The default XMonad module will use 0.17 if you are using the unstable NixOS channel (which should feel familiar coming from arch, being rolling release and all). Building XMonad with stack is at the very least unidiomatic and would be a huge hassle to get to work, so I wouldn’t recommend to you (actually, building XMonad with nixpkgs is atm equivalent to building XMonad with stack and the lts-19 resolver).