tvl-depot/desktop.nix
Vincent Ambo 7ca55c3fd5 feat(desktop): Move from i3 to exwm
Emacs just controls everything now. Why not!

Rather than using the builtin NixOS support for EXWM I've added a
custom snippet that takes care of the launching. This assumes that the
user launching the session has my emacs configuration installed, which
I, in practice, always do.

* remove setup of i3wm (until I'm comfortable using exwm I will keep
  the i3 configuration files around)
* disable compton (exwm brings its own compositor)
* disable auto-starting of emacs user service
* enable & configure exwm (also see correlating commits in my emacs.d
  repository)
2017-11-15 18:37:22 +01:00

67 lines
1.7 KiB
Nix

# Configuration for the desktop environment
{ config, lib, pkgs, ... }:
let wallpapers = import ./pkgs/wallpapers.nix;
in {
# Configure basic X-server stuff:
services.xserver = {
enable = true;
layout = "us,no";
xkbOptions = "caps:super, grp:shifts_toggle";
# Give EXWM permission to control the session.
displayManager.sessionCommands = "${pkgs.xorg.xhost}/bin/xhost +SI:localuser:$USER";
};
# Configure desktop environment:
services.xserver.windowManager.session = lib.singleton {
name = "exwm";
start = ''
${pkgs.emacs}/bin/emacs --daemon -f exwm-enable
emacsclient -c
'';
};
# Configure Redshift for Oslo
services.redshift = {
enable = true;
latitude = "59.911491";
longitude = "10.757933";
};
# Configure fonts
fonts = {
fonts = with pkgs; [
font-awesome-ttf
input-fonts
noto-fonts-cjk
noto-fonts-emoji
powerline-fonts
];
};
# Configure random setting of wallpapers
systemd.user.services.feh-wp = {
description = "Randomly set wallpaper via feh";
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "${wallpapers}/share/wallpapers";
# Manually shuffle because feh's --randomize option can't be restricted to
# just certain file types.
ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.fd}/bin/fd -atf | shuf | head -n1 | ${pkgs.findutils}/bin/xargs ${pkgs.feh}/bin/feh --bg-fill'";
};
};
systemd.user.timers.feh-wp = {
description = "Set a random wallpaper every hour";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
timerConfig = {
OnActiveSec = "1second";
OnUnitActiveSec = "1hour";
};
};
}