about summary refs log tree commit diff
path: root/users/tazjin/nixos/modules/desktop.nix
blob: 7249371ecc7d9eb9ef05a0a76c8fa0f404dbbfe9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# EXWM and other desktop configuration.
{ config, depot, lib, pkgs, ... }:

{
  imports = [
    ./reka.nix
  ];

  services = {
    pipewire = {
      enable = true;
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
    };

    blueman.enable = true;
    libinput.enable = true;

    displayManager.gdm.enable = true;
  };

  programs.niri.enable = true;
  services.gnome.gcr-ssh-agent.enable = lib.mkForce false;

  programs.xwayland.enable = true;

  environment.systemPackages = with pkgs; [
    # core packages
    xwayland-satellite
    swaylock

    # support tooling
    alacritty # TODO(tazjin): remove at some point
    fuzzel
    kanshi
    qt5.qtwayland
    swayidle
    depot.third_party.waybar
    wdisplays
    wl-clipboard
    wl-kbptr
    wl-mirror
    wlr-randr
    xfce4-appfinder
    depot.users.tazjin.niri-reap
  ];

  programs.foot = {
    enable = true;
    enableFishIntegration = true;
    settings.main = {
      dpi-aware = "yes";
      include = [
        "${pkgs.foot.themes}/share/foot/themes/tempus-totus"
        "${pkgs.foot.themes}/share/foot/themes/tempus-night"
      ];
    };
    settings.scrollback.lines = 1000000;
  };

  # Do not restart the display manager automatically
  systemd.services.display-manager.restartIfChanged = lib.mkForce false;

  # pipewire MUST start before niri, otherwise screen sharing doesn't work
  systemd.user.services.pipewire.wantedBy = [ "reka.service" "niri.service" ];
  systemd.user.services.pipewire.before = [ "reka.service" "niri.service" ];

  # enable "desktop portals", which are important somehow
  xdg.portal = {
    enable = true;
    extraPortals = with pkgs; [
      xdg-desktop-portal-gtk
      xdg-desktop-portal-gnome
      xdg-desktop-portal-wlr
    ];

    config = {
      # niri ships its own niri-portals.conf, nothing needed
      # TODO: configure this for reka session
      reka.default = [ "wlr" ];
      reka."org.freedesktop.impl.portal.ScreenCast" = [ "wlr" ];
    };
  };

  programs.reka = {
    enable = true;
    debug = true;
    launchCommand =
      let
        emacsWithReka = config.tazjin.emacs.override {
          emacs = depot.third_party.emacs-gpu;
          preInit = ''--eval "(require 'reka)" --eval "(reka-enable)" --eval "(require 'desktop)"'';
        };
      in
      "${emacsWithReka}/bin/tazjins-emacs";
  };

  # swaylock needs an empty PAM configuration, otherwise it locks the user out
  security.pam.services.swaylock = { };

  # enable theming support for Qt that is compatible with Chicago95 theme
  qt.enable = true;
  qt.platformTheme = "qt5ct";

  # If something needs more than 10s to stop it should probably be
  # killed.
  systemd.settings.Manager.DefaultTimeoutStopSec = "10s";
}