summaryrefslogtreecommitdiff
path: root/machines/kusanagi/desktop.nix
blob: e4b2bc389e8f3ea810495b30aaf4e6ac19231093 (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
# kusanagi-only desktop extras. The shared niri/dark/audio/firefox base comes
# from ../../profiles/desktop.nix (imported in ./default.nix); this file holds
# a few GNOME apps (no GNOME session), printing/scanning, pro-audio, richer
# fonts, and cursor theme. (Hardware-specific audio/NAS/server config lives in
# ./default.nix.)
{ pkgs, ... }:

{
  # --- GNOME apps without the GNOME session ---
  # We run niri, not GNOME, so the full `services.desktopManager.gnome` isn't
  # enabled: it dragged in gnome-shell, GDM, an X server, and — the reason this
  # went away — ibus, whose XDG autostart fired `ibus-daemon` under niri and
  # popped the "IBus has been started" notification on every login. Instead we
  # install just the GNOME apps we use (see systemPackages below) and enable
  # gvfs so Nautilus keeps trash, network shares, and removable-media mounting.
  # dconf (needed for their gsettings) comes from the shared desktop profile.
  services.gvfs.enable = true;

  # --- Printing / discovery / disks ---
  services.printing = {
    enable = true;
    drivers = with pkgs; [ gutenprint ];
  };

  # mDNS: printer discovery, and resolves kusanagi's *.local NAS names.
  services.avahi = {
    enable = true;
    nssmdns4 = true;
    openFirewall = true;
  };

  # prevent auto-mounting optical disks
  services.udisks2.enable = true;

  # --- Pro audio (extends the shared pipewire base) ---
  security.rtkit.enable = true;
  services.pipewire = {
    alsa.support32Bit = true;
    jack.enable = true;
    wireplumber.enable = true;
  };

  # --- GPG: forward the ssh-agent socket (workstation signs/auths via GPG) ---
  programs.gnupg.agent.enableSSHSupport = true;

  # --- Graphics: 32-bit for Steam/Wine ---
  hardware.graphics.enable32Bit = true;

  # --- Fonts: workstation extras + defaults (base packages from shared) ---
  fonts = {
    packages = with pkgs; [
      noto-fonts-cjk-sans
      noto-fonts-cjk-serif
      inter
      ibm-plex
      public-sans
    ];

    fontconfig = {
      defaultFonts = {
        monospace = [
          "Berkeley Mono"
          "Liberation Mono"
          "Symbols Nerd Font"
        ];
        sansSerif = [
          "Liberation Sans"
          "Noto Sans"
        ];
        serif = [ "Liberation Serif" ];
        emoji = [ "Nerd Font Symbols Only" ];
      };

      # Force ui-sans-serif and system-ui to resolve correctly
      localConf = ''
        <?xml version="1.0"?>
        <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
        <fontconfig>
          <alias>
            <family>system-ui</family>
            <prefer>
              <family>Liberation Sans</family>
            </prefer>
          </alias>
          <alias>
            <family>ui-sans-serif</family>
            <prefer>
              <family>Liberation Sans</family>
            </prefer>
          </alias>
        </fontconfig>
      '';
    };

    fontDir.enable = true;
  };

  # --- Cursor / renderer ---
  environment.sessionVariables = {
    GSK_RENDERER = "gl";
    XCURSOR_THEME = "Bibata-Modern-Classic";
    XCURSOR_SIZE = "24";
    HYPRCURSOR_THEME = "Bibata-Modern-Classic";
    HYPRCURSOR_SIZE = "24";
  };

  # --- User: desktop groups (niri essentials + printing). Hardware groups
  # (cdrom/optical/sg/scanner) stay in ./default.nix. ---
  users.users.henz.extraGroups = [
    "audio"
    "lp"
    "input"
  ];

  # --- Desktop tools specific to kusanagi (shared ones come from the profile) ---
  environment.systemPackages = with pkgs; [
    waybar
    networkmanagerapplet

    # GNOME apps we use standalone (no GNOME session; see gvfs note above).
    nautilus # file manager
    loupe # image viewer
  ];

  # --- Bar + wallpaper (was spawn-at-startup in the shared niri config.kdl) ---
  # The bar and wallpaper differ per host, so they live in nixos-config rather
  # than the stowed niri config. Long-running user services bound to
  # graphical-session.target (the target niri-session activates).
  # NOTE: there's no waybar package in the dotfiles repo yet, so this starts
  # default waybar; styling/modules are a separate follow-up.
  systemd.user.services.waybar = {
    description = "waybar status bar";
    wantedBy = [ "graphical-session.target" ];
    partOf = [ "graphical-session.target" ];
    after = [ "graphical-session.target" ];
    serviceConfig = {
      ExecStart = "${pkgs.waybar}/bin/waybar";
      Restart = "on-failure";
    };
  };

  systemd.user.services.swaybg = {
    description = "swaybg wallpaper";
    wantedBy = [ "graphical-session.target" ];
    partOf = [ "graphical-session.target" ];
    after = [ "graphical-session.target" ];
    serviceConfig = {
      ExecStart = "${pkgs.swaybg}/bin/swaybg --image '/home/henz/resources/photography/nasa/55196710272_1289069236_o.jpg' --mode fill";
      Restart = "on-failure";
    };
  };
}