aboutsummaryrefslogtreecommitdiff
path: root/modules/desktop/options.nix
blob: 3e206436895ba5e0407dd9ef302b3f7c244c5220 (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
{
  pkgs,
  config,
  lib,
  my-lib,
  ...
}: let
  inherit (lib) mkOption mkEnableOption types;
  inherit (my-lib.options {inherit lib config;}) mkProgramOption mkThemeOption;
in {
  options = {
    collinux.desktop = {
      wallpaper = mkOption {
        type = with types; oneOf [str path];
        description = "File to use as the wallpaper on this machine";
      };
      wallpaper_cmd = mkOption {
        type = types.str;
        default = "${lib.getExe pkgs.wbg} -s ${config.collinux.desktop.wallpaper}";
        internal = true;
      };

      greetd = {
        enable = mkEnableOption "greetd greeter";
        autologin = {
          enable = mkEnableOption "autologin";
          command = mkOption {
            internal = true;
            type = lib.types.str;
            default = with config.collinux.desktop;
              if (wm.sway.enable && !gnome.enable && !wm.niri.enable)
              then "${pkgs.sway}/bin/sway"
              else if (wm.niri.enable && !gnome.enable && !wm.sway.enable)
              then "${pkgs.niri}/bin/niri-session"
              else null;
          };
        };
        cosmic-greeter.enable = mkEnableOption "cosmic-greeter";
      };
      gdm.enable = mkEnableOption "gdm display manager";

      wm = {
        sway.enable = mkEnableOption "sway";
        niri.enable = mkEnableOption "niri";

        gtkDesktopPortal.enable = mkEnableOption "GTK desktop portal backend";
        kdeDesktopPortal.enable = mkEnableOption "KDE desktop portal backend";

        components = {
          dunst = mkProgramOption "dunst";
          fuzzel = mkProgramOption "fuzzel";
          tofi = mkProgramOption "tofi";
        };
      };
      gnome.enable = mkEnableOption "gnome";

      gtk = {
        enable = mkEnableOption "gtk theming";
        theme = mkThemeOption "gtk";

        cursor_data = mkOption {
          internal = true;
          type = lib.types.submodule {
            options = {
              package = mkOption {
                internal = true;
                type = lib.types.package;
              };
              name = mkOption {
                internal = true;
                type = lib.types.str;
              };
            };
          };
          default =
            if config.collinux.desktop.gtk.theme == "catppuccin"
            then {
              name = "catppuccin-mocha-dark-cursors";
              package = pkgs.catppuccin-cursors.mochaDark;
            }
            else if config.collinux.desktop.gtk.theme == "adwaita"
            then {
              name = "Vanilla-DMZ";
              package = pkgs.vanilla-dmz;
            }
            else null;
        };

        theme_data = mkOption {
          internal = true;
          type = lib.types.submodule {
            options = {
              package = mkOption {
                internal = true;
                type = lib.types.package;
              };
              name = mkOption {
                internal = true;
                type = lib.types.str;
              };
            };
          };

          default =
            if config.collinux.desktop.gtk.theme == "catppuccin"
            then {
              package = pkgs.catppuccin-gtk.override {
                variant = "mocha";
                accents = ["blue"];
                size = "standard";
              };
              name = "catppuccin-mocha-blue-standard";
            }
            else if config.collinux.desktop.gtk.theme == "adwaita"
            then {
              package = pkgs.adw-gtk3;
              name = "adw-gtk3";
            }
            else null;
        };
      };

      qt = {
        enable = mkEnableOption "qt theming";
        theme = mkThemeOption "qt";
        iconTheme = mkOption {
          type = types.str;
          default = "Papirus";
          description = "Icon theme to use for Qt/KDE applications";
        };
      };

      programs = {
        firefox = {
          enable = mkEnableOption "firefox";
          profileName = mkOption {
            type = types.str;
            default = config.collinux.user.name;
            internal = true;
          };
          theme = mkThemeOption "firefox";
          extensions.zotero.enable = mkOption {
            description = "install Zotero Connector for Firefox";
            default = config.collinux.desktop.programs.research.enable;
          };
        };

        foot = mkProgramOption "foot";
        blackbox.enable = mkEnableOption "blackbox";
        ghostty.enable = mkEnableOption "ghostty";
        alacritty.enable = mkEnableOption "alacritty";

        research.enable = mkEnableOption "zathura, Xournal++, Zotero";
      };
    };
  };

  config = {
    assertions = [
      {
        assertion = with config.collinux.desktop; !(gdm.enable && greetd.enable);
        message = "Can't enable gdm and greetd at the same time";
      }
      {
        assertion = with config.collinux.desktop.greetd; enable -> !(autologin.enable && cosmic-greeter.enable);
        message = "Can't use autologin and cosmic-greeter at the same time";
      }
      {
        assertion = with config.collinux.desktop.wm; !(gtkDesktopPortal.enable && kdeDesktopPortal.enable);
        message = "Can't enable GTK and KDE desktop portal backends at the same time";
      }
    ];
  };
}