aboutsummaryrefslogtreecommitdiff
path: root/roles/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'roles/desktop')
-rw-r--r--roles/desktop/default.nix61
-rw-r--r--roles/desktop/input.nix31
-rw-r--r--roles/desktop/xserver.nix28
3 files changed, 120 insertions, 0 deletions
diff --git a/roles/desktop/default.nix b/roles/desktop/default.nix
new file mode 100644
index 0000000..c2fae92
--- /dev/null
+++ b/roles/desktop/default.nix
@@ -0,0 +1,61 @@
+{ config, pkgs, lib, ... }:
+with lib;
+
+let cfg = config.roles.desktop; in {
+ imports = [
+ ./input.nix
+ ./xserver.nix
+ ];
+
+ options.roles.desktop = {
+ enable = mkEnableOption "desktop";
+ };
+
+ config = mkIf cfg.enable {
+ security.rtkit.enable = true;
+
+ i18n.inputMethod.enable = true;
+
+ services = {
+ displayManager.enable = true;
+
+ xserver = {
+ enable = true;
+ displayManager.lightdm.enable = true;
+ windowManager.i3.enable = true;
+ };
+
+ keyd.enable = true;
+
+ pipewire = {
+ enable = true;
+
+ pulse.enable = true;
+ alsa.enable = true;
+ alsa.support32Bit = true;
+ #jack.enable = true;
+ };
+ };
+
+ fonts = {
+ packages = with pkgs; [
+ nerdfonts
+ noto-fonts
+ noto-fonts-cjk
+ noto-fonts-cjk-sans
+ noto-fonts-cjk-serif
+ noto-fonts-emoji
+
+ minecraftia
+ ];
+
+ fontconfig = {
+ defaultFonts = {
+ monospace = [ "CaskaydiaMono Nerd Font" ];
+ sansSerif = [ "DejaVu Sans" "Noto Sans CJK JP" "Noto Sans" ];
+ serif = [ "DejaVu Serif" "Noto Serif CJK JP" "Noto Serif" ];
+ };
+ };
+ };
+ };
+}
diff --git a/roles/desktop/input.nix b/roles/desktop/input.nix
new file mode 100644
index 0000000..20e9da8
--- /dev/null
+++ b/roles/desktop/input.nix
@@ -0,0 +1,31 @@
+{ pkgs, ... }:
+
+{
+ services.keyd = {
+ keyboards."*".settings = {
+ main = {
+ # Swap alt and meta keys.
+ # I prefer (physical) alt as my WM modifier key because it
+ # is easier to reach. This can collide with some programs
+ # shortcuts if they inlcude alt. Swapping alt and meta fixes
+ # this by making my WM mod key (software) meta, freeing up alt.
+
+ leftalt = "leftmeta";
+ leftmeta = "leftalt";
+
+ rightalt = "rightmeta";
+ rightmeta = "rightalt";
+ };
+ };
+ };
+
+ i18n.inputMethod = {
+ type = "fcitx5";
+ fcitx5.addons = with pkgs; [ fcitx5-mozc ];
+ };
+
+ environment.variables = {
+ # Required for fcitx5 support in kitty
+ GLFW_IM_MODULE = "ibus";
+ };
+}
diff --git a/roles/desktop/xserver.nix b/roles/desktop/xserver.nix
new file mode 100644
index 0000000..461de83
--- /dev/null
+++ b/roles/desktop/xserver.nix
@@ -0,0 +1,28 @@
+{ pkgs, ... }:
+
+{
+ services.displayManager = {
+ defaultSession = "none+i3";
+ };
+
+ services.xserver = {
+ videoDrivers = [ "amdgpu" ];
+
+ displayManager = {
+ setupCommands = ''
+ if ${pkgs.xorg.xrandr}/bin/xrandr --query | grep 2560x1080; then
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DVI-D-0 --mode 1920x1080 --rate 60 --pos 0x0
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-2 --mode 2560x1080 --rate 60 --pos 1920x0 --primary
+ ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-A-0 --mode 1920x1080 --rate 75 --pos 4480x0
+ elif ${pkgs.xorg.xrandr}/bin/xrandr --query | grep 2560x1440; then
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DVI-D-0 --mode 1920x1080 --rate 60 --pos 0x360
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-2 --mode 2560x1440 --rate 165 --pos 1920x0 --primary
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-1 --mode 1920x1200 --rate 60 --pos 4480x0
+ fi
+ '';
+ };
+
+ xkb.layout = "us";
+# xkb.options = "eurosign:e,caps:escape";
+ };
+}