aboutsummaryrefslogtreecommitdiff
path: root/system/rice-desktop.nix
blob: 78a63e94f04d13c270cc74c6878fa92263b0a27f (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
{
  config,
  lib,
  pkgs,
  ...
}: let
  cfg = config.rice;
in {
  options.rice = {
    desktop = {
      environment = lib.mkOption {
        type = lib.types.enum ["i3" "plasma" "none"];
        default = "i3";
        description = "Desktop environment to use";
      };

      wayland.enable = lib.mkOption {
        type = lib.types.bool;
        default = false;
        description = "Enable Wayland support";
      };

      compositor.enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = "Enable picom compositor (for X11 environments)";
      };
    };

    stylix = {
      overrideColors = lib.mkOption {
        type = lib.types.bool;
        default = false;
        description = "Override system stylix colors with rice-specific colors";
      };

      base16Scheme = lib.mkOption {
        type = lib.types.nullOr lib.types.attrs;
        default = null;
        description = "Custom Base16 color scheme";
      };

      wallpaper = lib.mkOption {
        type = lib.types.nullOr lib.types.path;
        default = null;
        description = "Custom wallpaper path or derivation";
      };

      fonts = lib.mkOption {
        type = lib.types.nullOr lib.types.attrs;
        default = null;
        description = "Custom font configuration";
      };
    };
  };

  config = lib.mkMerge [
    # Default stylix configuration (can be overridden by rices)
    {
      stylix = {
        enable = true;
        autoEnable = true;

        # Default Base16 scheme - Nord Blue inspired
        base16Scheme = lib.mkDefault {
          base00 = "2D333F"; # background
          base01 = "3B4252"; # lighter background
          base02 = "434C5E"; # selection background
          base03 = "4C566A"; # comments
          base04 = "D8DEE9"; # dark foreground
          base05 = "C6D0F5"; # foreground
          base06 = "E5E9F0"; # light foreground
          base07 = "ECEFF4"; # lightest foreground
          base08 = "BF616A"; # red
          base09 = "D5A18E"; # orange/tan
          base0A = "EBCB8B"; # yellow
          base0B = "A3BE8C"; # green
          base0C = "88C0D0"; # cyan
          base0D = "82A3C0"; # blue (accent)
          base0E = "B48EAD"; # purple
          base0F = "5E81AC"; # dark blue
        };

        # Default wallpaper
        image = lib.mkDefault (pkgs.fetchurl {
          url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/master/wallpapers/nix-wallpaper-simple-blue.png";
          sha256 = "sha256-utrcjzfeJoFOpUbFY2eIUNCKy5rjLt57xIoUUssJmdI=";
        });

        # Default fonts
        fonts = lib.mkDefault {
          monospace = {
            package = pkgs.nerd-fonts.jetbrains-mono;
            name = "JetBrainsMono Nerd Font";
          };
          sansSerif = {
            package = pkgs.noto-fonts;
            name = "Noto Sans";
          };
          serif = {
            package = pkgs.noto-fonts;
            name = "Noto Serif";
          };
          emoji = {
            package = pkgs.noto-fonts-color-emoji;
            name = "Noto Color Emoji";
          };
          sizes = {
            terminal = 10;
            applications = 11;
            desktop = 11;
          };
        };

        # Default cursor
        cursor = lib.mkDefault {
          package = pkgs.bibata-cursors;
          name = "Bibata-Modern-Classic";
          size = 24;
        };

        # Default opacity
        opacity = lib.mkDefault {
          terminal = 0.95;
          applications = 1.0;
          desktop = 1.0;
          popups = 0.95;
        };

        # Default polarity
        polarity = lib.mkDefault "dark";

        # Disable nixos-icons to avoid conflict
        targets.nixos-icons.enable = false;
      };
    }

    # Rice-specific stylix overrides
    (lib.mkIf cfg.stylix.overrideColors {
      stylix = {
        base16Scheme = lib.mkIf (cfg.stylix.base16Scheme != null) (lib.mkForce cfg.stylix.base16Scheme);
        image = lib.mkIf (cfg.stylix.wallpaper != null) (lib.mkForce cfg.stylix.wallpaper);
        fonts = lib.mkIf (cfg.stylix.fonts != null) (lib.mkForce cfg.stylix.fonts);
      };
    })

    # i3 desktop environment
    (lib.mkIf (cfg.desktop.environment == "i3") {
      services.xserver = {
        enable = true;
        windowManager.i3.enable = true;

        # Czech QWERTZ layout
        xkb = {
          layout = "cz";
          options = "eurosign:e,caps:escape";
        };
      };

      # Compositor for X11
      services.picom.enable = cfg.desktop.compositor.enable;
    })

    # KDE Plasma desktop environment
    (lib.mkIf (cfg.desktop.environment == "plasma") {
      # Enable KDE Plasma 6
      services.displayManager.sddm = {
        enable = true;
        wayland.enable = cfg.desktop.wayland.enable;
      };

      services.desktopManager.plasma6.enable = true;

      # X11 configuration for Plasma (if not using Wayland)
      services.xserver = {
        enable = true;
        xkb = {
          layout = "cz";
          options = "eurosign:e,caps:escape";
        };
      };

      # KDE-specific packages
      environment.systemPackages = with pkgs; [
        kdePackages.kate
        kdePackages.konsole
        kdePackages.dolphin
        kdePackages.spectacle
        kdePackages.gwenview
      ];
    })
  ];
}