summaryrefslogtreecommitdiff
path: root/machines/enzo/desktop.nix
blob: 4d1c29b77bf32aaa0209435f9b5e6bc44d82d01c (plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Minimal niri desktop for enzo — deliberately separate from ../../profiles/desktop.nix
# so the laptop can grow on its own terms. Add to it (or switch to the shared
# profile) whenever you want more.
{ pkgs, ... }:

{
  # --- Session / login ---
  programs.niri.enable = true;
  programs.dconf.enable = true;

  # Tell the desktop it's in dark mode. Apps read light/dark from
  # xdg-desktop-portal's Settings interface (org.freedesktop.appearance
  # color-scheme). This dconf default is the value the portal serves.
  programs.dconf.profiles.user.databases = [
    {
      settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
    }
  ];

  # Serve color-scheme from the *gtk* portal backend, not gnome. The niri module
  # routes Settings to xdg-desktop-portal-gnome (its default), but that backend
  # relies on gnome-settings-daemon — absent under bare niri — so it reports
  # "no preference" and web content (LibreWolf's prefers-color-scheme) stays
  # light even though GTK chrome follows the dark GTK theme. xdg-desktop-portal-
  # gtk reads the dconf color-scheme above directly, so pinning Settings to it
  # makes the portal actually report dark and content follows. This key merges
  # into the niri module's xdg.portal.config.niri.
  xdg.portal = {
    extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
    config.niri."org.freedesktop.impl.portal.Settings" = "gtk";
  };

  services.greetd = {
    enable = true;
    settings.default_session = {
      command = "${pkgs.tuigreet}/bin/tuigreet --time --remember --cmd niri-session";
      user = "greeter";
    };
  };
  # Let tuigreet write its cache (for --remember).
  systemd.services.greetd.serviceConfig = {
    Type = "idle";
    StandardInput = "tty";
    StandardOutput = "tty";
    StandardError = "journal";
    TTYReset = true;
    TTYVHangup = true;
    TTYVTDisallocate = true;
  };

  # --- Graphics ---
  hardware.graphics.enable = true;

  # --- Audio (playback only; no rtkit/jack — enzo isn't for recording).
  # If you ever hear dropouts under load, add: security.rtkit.enable = true;
  services.pulseaudio.enable = false;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    pulse.enable = true;
  };

  # --- Fonts (minimal) ---
  # TODO move to common
  fonts = {
    enableDefaultPackages = true;
  packages = with pkgs; [
    noto-fonts
    nerd-fonts.symbols-only
    adwaita-fonts
  ];
  fontconfig = {
  enable = true;
  defaultFonts = {
  monospace = [ "Adwaita Mono" ];
  };
  };
  };

  environment.sessionVariables = {
    XCURSOR_THEME = "Adwaita";
    XCURSOR_SIZE = "24";
  };

  # Cursor theme referenced by XCURSOR_THEME / niri's xcursor-theme. Without this
  # package the Adwaita cursor files aren't on disk, so named shapes (e.g. the
  # link "pointer"/hand) fail to load and the cursor never changes on hover.
  environment.systemPackages = [ pkgs.adwaita-icon-theme ];

  # --- User: groups + niri essentials ---
  users.users.hwebs.extraGroups = [
    "audio"
    "input"
  ];

  users.users.hwebs.packages = with pkgs; [
    # LibreWolf with customizations baked into the package. There's no
    # programs.librewolf module, but librewolf is wrapFirefox-based, so
    # extraPolicies writes an enterprise policy into the package's distribution
    # dir — no profile, no /etc file. Dark theme is handled desktop-wide by the
    # portal (see color-scheme dconf key above), so no theme prefs needed here.
    (librewolf.override {
      extraPolicies = {
        DisableAppUpdate = true;
        Preferences = {
          # LibreWolf enables resistFingerprinting by default, which spoofs web
          # content's prefers-color-scheme to light — so sites ignore the
          # desktop dark setting (and devtools can't toggle it). Turn it off so
          # pages follow dark; LibreWolf keeps its other protections (uBlock, no
          # telemetry).
          #
          # Must be "locked", not "default": LibreWolf's mozilla.cfg does
          # defaultPref("privacy.resistFingerprinting", true), and a policy
          # "default" writes the same branch and loses the tie to the autoconfig.
          # "locked" wins over defaultPref.
          "privacy.resistFingerprinting" = {
            Value = false;
            Status = "locked";
          };

          # Blank home page + blank new tab
          "browser.startup.homepage" = {
            Value = "about:blank";
            Status = "default";
          };
          "browser.startup.page" = {
            Value = 0; # 0 = blank on startup
            Status = "default";
          };
          "browser.newtabpage.enabled" = {
            Value = false;
            Status = "default";
          };
          # Hide the bookmarks toolbar
          "browser.toolbars.bookmarks.visibility" = {
            Value = "never";
            Status = "default";
          };
        };
      };
    })

    ghostty # terminal
    fuzzel # launcher
    swaybg # wallpaper
    xwayland-satellite # run X11 apps under niri
    mako # notifications
    libnotify # notify-send
    yambar # text status bar
    gnupg # gpg
    pinentry-gnome3 # passphrase prompt for the gpg agent
  ];

  # --- GPG ---
  # Agent + a GTK pinentry (works under niri). enableSSHSupport is left off so
  # gpg-agent doesn't hijack the ssh-agent socket for your existing SSH key;
  # turn it on only if you sign in via a GPG auth subkey.
  programs.gnupg.agent.enable = true;

  # --- Console / greeter font (HiDPI panel) ---
  # The eDP panel is high-density, so the kernel VT and tuigreet render with a
  # tiny 8x16 font. A large Terminus bitmap font makes the TTY and the greeter
  # legible; earlySetup applies it from initrd so it's big from the first frame.
  # Sizes: ter-v{16,18,20,22,24,28,32}n — bump/drop to taste.
  console = {
    earlySetup = true;
    packages = [ pkgs.terminus_font ];
    font = "ter-v32n";
  };
}