aboutsummaryrefslogtreecommitdiff
path: root/nix/modules/default.nix
blob: db5f82ef946b1cf3299b6a343c83b3bd32882e27 (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
{ lib, config, pkgs, ... }:
{
  imports = [
    ./configuration.nix
  ];

  options = {
    monorepo = {
      vars = import ./vars.nix;

      profiles = {
        documentation.enable = lib.mkEnableOption "Enables documentation on system.";
        secureBoot.enable = lib.mkEnableOption "Enables secure boot. See sbctl.";
        pipewire.enable = lib.mkEnableOption "Enables pipewire low latency audio setup";
        tor.enable = lib.mkEnableOption "Enables tor along with torsocks";


        home = {
          enable = lib.mkEnableOption "Enables home manager desktop configuration";
          # Programs
          lang-c.enable = lib.mkEnableOption "Enables C language support";
          lang-shell.enable = lib.mkEnableOption "Enables sh language support";
          lang-rust.enable = lib.mkEnableOption "Enables Rust language support";
          lang-python.enable = lib.mkEnableOption "Enables python language support";
          lang-sol.enable = lib.mkEnableOption "Enables solidity language support";
          lang-openscad.enable = lib.mkEnableOption "Enables openscad language support";
          lang-js.enable = lib.mkEnableOption "Enables javascript language support";
          lang-nix.enable = lib.mkEnableOption "Enables nix language support";

          crypto.enable = lib.mkEnableOption "Enables various cryptocurrency wallets";
          art.enable = lib.mkEnableOption "Enables various art programs";
          music.enable = lib.mkEnableOption "Enables mpd";

          hyprland = {
            enable = lib.mkEnableOption "Enables hyprland";
            monitors = lib.mkOption {
              type = lib.types.listOf lib.types.str;
              default = [
                "HDMI-A-1"
                "eDP-1"
                "DP-2"
                "DP-3"
                "LVDS-1"
              ];
              example = [];
              description = "Hyprland monitors";
            };
          };
          email = {
            email = lib.mkOption {
              type = lib.types.str;
              default = "ret2pop@gmail.com";
              example = "john@example.com";
              description = "Email address and imaps/smtps account";
            };
            imapsServer = lib.mkOption {
              type = lib.types.str;
              default = "imap.gmail.com";
              example = "imap.example.com";
              description = "imaps server address";
            };
            smtpsServer = lib.mkOption {
              type = lib.types.str;
              default = "smtp.gmail.com";
              example = "smtp.example.com";
              description = "smtp server address";
            };
            enable = lib.mkEnableOption "Enables email";
          };
        };
      };
    };
  };

  config = {
    environment.systemPackages = lib.mkIf config.monorepo.profiles.documentation.enable (with pkgs; [
      linux-manual
      man-pages
      man-pages-posix
    ]);

    home-manager.users."${config.monorepo.vars.userName}".home.packages = lib.flatten [
      (lib.mkIf config.monorepo.home.email.enable [ pkgs.mu ])
      (lib.mkIf config.monorepo.home.lang-c.enable (with pkgs; [
        autobuild
        clang
        gdb
        gnumake
        bear
        clang-tools
      ]))

      (lib.mkIf config.monorepo.home.lang-js.enable (with pkgs; [
        nodejs
        bun
        yarn
        typescript
        vscode-langservers-extracted
      ]))

      (lib.mkIf config.monorepo.home.lang-rust.enable (with pkgs; [
        cargo
        rust-analyzer
        rustfmt
      ]))

      (lib.mkIf config.monorepo.home.lang-python.enable (with pkgs; [
        poetry
        python3
        python312Packages.jedi
      ]))

      (lib.mkIf config.monorepo.home.lang-sol.enable (with pkgs; [
        solc
      ]))

      (lib.mkIf config.monorepo.home.lang-openscad.enable (with pkgs; [
        openscad
        openscad-lsp
      ]))

      (lib.mkIf config.monorepo.home.lang-sh.enable (with pkgs; [
        bash-language-server
      ]))

      (lib.mkIf config.monorepo.home.lang-nix.enable (with pkgs; [
        nil
        nixd
        nixfmt-rfc-style
      ]))

      (lib.mkIf config.monorepo.home.crypto.enable (with pkgs; [
        bitcoin
        electrum
        monero-cli
        monero-gui
      ]))

      (lib.mkIf config.monorepo.home.art.enable (with pkgs; [
        inkscape
        krita
      ]))

      (lib.mkIf config.monorepo.home.music.enable (with pkgs; [
        mpc-cli
        sox
      ]))

      (lib.mkIf config.monorepo.tor.enable (with pkgs; [
        tor-browser
        torsocks
      ]))

      (lib.mkIf config.monorepo.pipewire.enable (with pkgs; [
        helvum
      ]))
    ];

    monorepo = {
      profiles = {
        documentation.enable = lib.mkDefault true;
        pipewire.enable = lib.mkDefault true;
        tor.enable = lib.mkDefault true;
        home = {
          enable = lib.mkDefault true;
          music.enable = lib.mkDefault config.monorepo.profiles.pipewire.enable;
          hyprland.enable = lib.mkDefault true;
          email.enable = lib.mkDefault true;

          # Programming
          lang-c.enable = lib.mkDefault true;
          lang-rust.enable = lib.mkDefault true;
          lang-python.enable = lib.mkDefault true;
          lang-sol.enable = lib.mkDefault true;
          lang-sh.enable = lib.mkDefault true;
          lang-openscad.enable = lib.mkDefault true;
          lang-js.enable = lib.mkDefault true;
          lang-nix.enable = lib.mkDefault true;

          crypto.enable = lib.mkDefault true;
          art.enable = lib.mkDefault true;
        };
      };
    };
  };
}