~ruther/nixos-config

ref: d9b932819886d771f6b35d2bf75f369883e095c2 nixos-config/home/modules/profiles/base.nix -rw-r--r-- 7.9 KiB
d9b93281 — Frantisek Bohacek feat(zsh): use zsh-vi-mode, emacs plugin 8 months ago
                                                                                
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
{ inputs, config, lib, pkgs, ... }:

let
  nur = import inputs.nur {
    nurpkgs = import inputs.nixpkgs { inherit (pkgs) system; };
    inherit pkgs;
  };
in {
  options = {
    profiles.base = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
      };
    };
  };

  config = lib.mkIf config.profiles.base.enable {
    home-config.startup.apps = [ (lib.getExe pkgs.firefox) ];

    home.activation = {
      noshellLink = {
        after = [ "writeBoundery" "createXdgUserDirectories" ];
        before = [];
        data = ''
          if [[ ! -f "$HOME/.config/shell" ]]; then
            ln -s ${lib.getExe pkgs.zsh} $HOME/.config/shell
          fi
        '';
      };
    };

    programs = {

    dircolors = {
      enable = true;
      settings = {
        OTHER_WRITABLE = "01;35"; # Make ntfs colors readable
      };
    };

    kitty = {
      enable = true;
      font = {
        name = "FiraCode Nerd Font";
        size = 12;
      };
      theme = "Chalk";
    };

    alacritty = {
      enable = true;
      settings = {
        font = {
          normal.family = "FiraCode Nerd Font";
          bold = { style = "Bold"; };
          size = 12;
        };
        # offset = {                            # Positioning
        #   x = -1;
        #   y = 0;
        # };
      };
    };

    foot = {
      enable = true;
      settings = {
        main = {
          font = "FiraCode Nerd Font:size=12";
        };
      };
    };

      starship = {
        enable = true;
      };

      zsh = {
        enable = true;
        autosuggestion = {
          enable = true;
        };
        syntaxHighlighting.enable = true;
        enableCompletion = true;
        history.size = 100000;

        plugins = let
          inherit (pkgs) fetchFromGitHub;
        in [
          {
            name = "emacs";
            src = fetchFromGitHub {
              owner = "Flinner";
              repo = "emacs";
              rev = "7d12669fe2738ef98444d857f2bbeaf409de2b06";
              hash = "sha256-zqPSCziEJK32o9EzxzvhRRq5TRtj/daBEXd21XTsXsU=";
            };
          }
          {
            name = "zsh-vi-mode";
            src = pkgs.zsh-vi-mode;
            file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
          }
        ];

        # oh-my-zsh = {                               # Extra plugins for zsh
        #   enable = true;
        #   plugins = [ "git" ];
        # };

        initExtra = ''
            zstyle ':completion:*:*:*:*:*' menu select

            function exa-nixpkgs-derivation {
              nix run nixpkgs#eza -- --tree $(nix build nixpkgs#$1 --print-out-paths --out-link /tmp/$1)
            }

            mkreal() {
              cp $1 $1.bcp
              chmod +w $1.bcp
              mv $1.bcp $1
            }
        '';
      };

      firefox = {
        enable = true;
        package = pkgs.firefox.override {
          nativeMessagingHosts = [
            pkgs.tridactyl-native
          ];
        };
        profiles = {
          default = {
            id = 0;
            name = "Default";
            isDefault = true;

            userChrome = ''
                #navigator-toolbox { font-family:Ubuntu !important }
            '';

            extensions = with nur.repos.rycee.firefox-addons; [
              # Basic
              proton-pass                # Password manager
              darkreader                 # Dark pages
              ublock-origin              # Ad block
              tridactyl                  # Vim-like keybindings

              # Containers
              multi-account-containers

              # Site specific
              # social fixer for facebook

              # UI
              text-contrast-for-dark-themes

              # Utility
              istilldontcareaboutcookies
              h264ify
              youtube-shorts-block

              # Privacy
              link-cleaner
              clearurls
              decentraleyes
              privacy-badger
              skip-redirect

              # Paywalls
              # bypass-paywalls-clean
            ];

            settings = {
              "beacon.enabled" = false;
              "browser.contentblocking.category" = "strict";

              "browser.newtabpage.enabled" = false; # Blank new tab page.
              "browser.startup.page" = 3; # Resume last session.
              "browser.tabs.closeWindowWithLastTab" = false;

              "browser.download.dir" = "${config.home.homeDirectory}/download";
              "browser.toolbars.bookmarks.visibility" = "newtab";
              "signon.rememberSignons" = false;
              "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
              "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;

              "layout.css.prefers-color-scheme.content-override" = 2;
              "browser.uidensity" = 1; # Dense.
              "extensions.unifiedExtensions.enabled" = false; # Disable extensions symbol in bar
              "layout.css.devPixelsPerPx" = 1; # Default zoom?

              "media.ffmpeg.vaapi.enabled" = true;
              "gfx.webrender.all" = true;

              "network.IDN_show_punycode" = true;

              "permissions.default.shortcuts" = 3; # Don't steal my shortcuts!

              "toolkit.legacyUserProfileCustomizations.stylesheets" = true;

              "full-screen-api.warning.timeout" = 0;

              # Privacy
              "browser.search.hiddenOneOffs" =
                "Google,Yahoo,Bing,Amazon.com,Twitter";
                "browser.send_pings" = false;
                "dom.battery.enabled" = false;
                "dom.security.https_only_mode" = true;
                "network.dns.disablePrefetch" = true;
                "geo.enabled" = false;
                "browser.urlbar.speculativeConnect.enabled" = false; # Do not resolve dns before clicking
                "network.prefetch-next" = false;
                "media.video_stats.enabled" = false;

                "network.http.referer.XOriginPolicy" = 2;
                "network.http.referer.XOriginTrimmingPolicy" = 2;
                "network.http.referer.trimmingPolicy" = 1;

                "privacy.donottrackheader.enabled" = true;
                "privacy.donottrackheader.value" = 1;
                "privacy.firstparty.isolate" = true;

                # Fully disable Pocket. See
                # https://www.reddit.com/r/linux/comments/zabm2a.
                "extensions.pocket.enabled" = false;
                "extensions.pocket.api" = "0.0.0.0";
                "extensions.pocket.loggedOutVariant" = "";
                "extensions.pocket.oAuthConsumerKey" = "";
                "extensions.pocket.onSaveRecs" = false;
                "extensions.pocket.onSaveRecs.locales" = "";
                "extensions.pocket.showHome" = false;
                "extensions.pocket.site" = "0.0.0.0";
                "browser.newtabpage.activity-stream.pocketCta" = "";
                "browser.newtabpage.activity-stream.section.highlights.includePocket" =
                  false;
                  "services.sync.prefs.sync.browser.newtabpage.activity-stream.section.highlights.includePocket" =
                    false;
            };
          };
        };
      };

      # Email
      thunderbird = {
        enable = true;
        profiles = {
          default = {
            isDefault = true;
          };
        };
      };
    };

    accounts.email = {
      accounts = {
        ctu = {
          primary = true;
          thunderbird = {
            enable = true;
          };
          address = "bohacfr2@fel.cvut.cz";
          userName = "bohacfr2";
          realName = "František Boháček";
          imap = {
            host = "imap.fel.cvut.cz";
            port = 993;
          };
          smtp = {
            host = "smtpx.fel.cvut.cz";
            port = 465;
            tls = {
              enable = true;
            };
          };
        };
      };
    };
  };
}
Do not follow this link