aboutsummaryrefslogtreecommitdiff
path: root/xmonad.nix
diff options
context:
space:
mode:
authorTom Harley2020-12-31 06:22:10 +0000
committerTom Harley2020-12-31 06:22:10 +0000
commitf7cd94645921dae0b17e8666fcfa3e9b84f8111d (patch)
treea45350051567339b33917a8de1ec5bc98c3809da /xmonad.nix
parentAdd minimal README (diff)
downloadhome-manager-f7cd94645921dae0b17e8666fcfa3e9b84f8111d.tar.gz
home-manager-f7cd94645921dae0b17e8666fcfa3e9b84f8111d.zip

Put xmonad config in separate file

xmonad.hs is now its own standalone file, which is nice for syntax highlighting. The new version uses string substitution from nixpkgs’ standard library.

Diffstat (limited to 'xmonad.nix')
-rw-r--r--xmonad.nix43
1 files changed, 10 insertions, 33 deletions
diff --git a/xmonad.nix b/xmonad.nix
index 7647094..41a9e51 100644
--- a/xmonad.nix
+++ b/xmonad.nix
@@ -5,39 +5,16 @@
enable = true;
enableContribAndExtras = true;
- # would be nice to have this as an actual haskell file, so I
- # could get syntax highlighting, but I also need to make sure
- # external programs are included as runtime dependencies
- config = pkgs.writeText "xmonad.hs" ''
- import XMonad
- import XMonad.Actions.Volume
- import XMonad.Actions.PhysicalScreens
- import XMonad.Util.Dzen
- import XMonad.Hooks.EwmhDesktops
- import XMonad.Util.EZConfig
-
- import Data.Default
-
- mymod = mod4Mask
- myKeys =
- [ ((mymod, xK_p), spawn "${pkgs.rofi}/bin/rofi -show run")
- , ((mymod, xK_i), lowerVolume 5 >>= alert)
- , ((mymod, xK_o), raiseVolume 5 >>= alert)
- ]
- ++
- [((mymod .|. mask, key), f sc)
- | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
- , (f, mask) <- [(viewScreen def, 0), (sendToScreen def, shiftMask)]]
-
- alert = dzenConfig (timeout 3 >=> onCurr xScreen) . show . round
-
- main = xmonad $ ewmh $ def
- { terminal = "${pkgs.rxvt-unicode}/bin/urxvt"
- , modMask = mymod
- , borderWidth = 0
- , focusFollowsMouse = False
- } `additionalKeys` myKeys
- '';
+ config = pkgs.stdenv.mkDerivation {
+ name = "xmonad-config";
+ src = ./xmonad.hs;
+ dontUnpack = true;
+ terminal = "${pkgs.rxvt-unicode}/bin/urxvt";
+ dmenu = "${pkgs.rofi}/bin/rofi -combi-modi window,run -show combi -modi combi";
+ installPhase = ''
+ substituteAll "$src" "$out"
+ '';
+ };
};
xsession.enable = true;