nixos-config/components/gui/xorg/default.nix
2024-08-07 11:46:42 +02:00

81 lines
1.7 KiB
Nix

{ config, pkgs, lib, ... }:
with lib;
{
imports = [ ./xlock.nix ];
options.components.gui.xorg.enable = mkOption {
type = lib.types.bool;
default = config.components.gui.enable;
};
config = mkIf (config.components.gui.xorg.enable && config.components.gui.enable) {
# system.custom.fonts.enable = true;
services.displayManager = {
defaultSession = lib.mkDefault "none+i3";
autoLogin.enable = lib.mkDefault true;
autoLogin.user = config.users.users.mainUser.name;
};
services.xserver = {
enable = true;
displayManager = {
lightdm.enable = lib.mkDefault true;
};
desktopManager.xterm.enable = false;
windowManager.i3.enable = true;
# mouse/touchpad
# --------------
};
services.libinput = {
enable = true;
touchpad = {
disableWhileTyping = true;
tapping = true;
scrollMethod = "twofinger";
accelSpeed = "1.3";
naturalScrolling = true;
horizontalScrolling = true;
};
};
# Packages
# --------
environment.systemPackages = with pkgs; [
xclip
xtrlock-pam
xorg.xev
dmenu
arandr
xcalib
flameshot
feh
];
# Xresources config
# -----------------
# spread the Xresource config
# across different files
# just add a file into `/etc/X11/Xresource.d/` and it will be
# evaluated.
services.xserver.displayManager.sessionCommands = ''
for file in `ls /etc/X11/Xresource.d/`
do
${pkgs.xorg.xrdb}/bin/xrdb -merge /etc/X11/Xresource.d/$file
done
'';
environment.etc."/X11/Xresource.d/.keep".text = "";
};
}