summaryrefslogtreecommitdiff
path: root/lib/linux.nix
blob: ba0fbdf69ebb72c5806ff7f185dd2916f7ff6067 (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
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
{ pkgs, lib, ... }:

let
  inherit (import ./const.nix) fontSize homedir gpgid;
  inherit (import ./theme.nix { inherit pkgs lib; })
    theme colors base16-scheme base16-scheme-filename
    xresourcesFile;
  xmonadPackages = self: [
    self.xmonad-contrib
    #self.taffybar # fails to build
    self.xmonad-extras
    self.monad-logger
  ];
in
{
  imports = [
    ./common.nix

    # nix-channel --add https://github.com/catppuccin/nix/archive/main.tar.gz catppuccin
    #<catppuccin/modules/home-manager>

  ];
  home = {
    pointerCursor = {
      package = pkgs.phinger-cursors;
      name = "phinger-cursors";
    };
    keyboard.options = [ "caps:ctrl_modifier" ];
    sessionVariables = {
      LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
    };
    file = {
      mutt = {
        text = (builtins.readFile ./muttrc) +
          (builtins.readFile ./mutt/solarized.muttrc);
        target = ".muttrc";
      };
      mailcap = {
        source = ./mailcap;
        target = ".mailcap";
      };
      xbindkeys = {
        source = ./xbindkeysrc;
        target = ".xbindkeysrc";
      };
    };

    packages = with pkgs; [
      acpi
      apvlv
      beets
      bind
      blueman
      cmdtree
      dict
      dmenu
      feh
      firefox
      flameshot
      gajim
      glibcLocales # rofi locale fix -- https://github.com/rycee/home-manager/issues/354#issuecomment-415914278
      gnumake
      gnupg
      # keybase-gui
      libnotify
      lshw
      mplayer
      muchsync
      mumble
      nyxt
      pandoc
      pavucontrol
      pinentry
      tdesktop
      thunderbird
      # texlive.combined.scheme-full
      #tor-browser-bundle-bin
      usbutils
      vlc
      xbindkeys
      xclip
      xdotool
      xlayoutdisplay
      xorg.xmodmap
      xsel
      xterm
      yank
      youtube-dl
      zathura
    ];
  };

  #catppuccin.flavor = "latte";
  #catppuccin.enable = true;

  fonts.fontconfig.enable = true;

  gtk.enable = false; # this fails because of some missing service file
  gtk.font.name = "Fira Sans";
  gtk.font.size = fontSize;
  gtk.font.package = pkgs.fira;
  gtk.theme.name = "Breeze";
  gtk.iconTheme.name = "hicolor";
  gtk.cursorTheme.name = "breeze_cursors";

  xresources = {
    properties = {
      "XTerm*font" = "-*-FiraMono-medium-r-normal--${toString fontSize}-*-*-*-*-*-iso10646-1";
      "XTerm*faceName" = "FireMono";
      "XTerm*faceSize" = toString fontSize;
      "XTerm*termName" = "xterm-256color";
      "XTerm*metaSendsEscape" = true;
      "XTerm*utf8" = true;
      #"Xautolock.time:" = 1;
      #"Xautolock.locker:" = "xlock";
      #"Xautolock.corners:" = "+0-0";
      #"Xautolock.cornerdelay:" = 3;
      #"Xautolock.notify:" = 30;
      #"Xautolock.notifier:" = "notify-send -u critical -t 10000 -- 'Locking screen in 30 seconds'";
    };
    extraConfig = builtins.readFile xresourcesFile;
  };

  services = {
    lorri.enable = false;
    emacs.enable = true;

    kbfs.enable = false;
    keybase.enable = false;

    mbsync = {
      frequency = "*:0/5";
      postExec = "${pkgs.notmuch}/bin/notmuch new";
    };


    dunst = {
      enable = true;
      settings = {
        global = {
          geometry = "320x5-10+30";
          transparency = 0;
          frame_color = colors."${theme}".highlight;
          frame_width = 3; # same as xmonad border
          separator_color = "frame";
          font = "Fira Sans";
          background = colors."${theme}".background;
          foreground = colors."${theme}".foreground;
          padding = 10;
          horizontal_padding = 10;
          word_wrap = "yes";
          markup = "full";
          format = "<b>%s</b>\\n%b\\n";
        };

        urgency_normal = {
          background = colors."${theme}".background;
          foreground = colors."${theme}".foreground;
          timeout = 10;
        };
      };
    };

    redshift = {
      enable = false;
      latitude = "40.80";
      longitude = "-81.52";
      temperature = {
        # orange = 1000, white = 5000
        day = 5000;
        night = 1800;
      };
    };

    random-background = {
      enable = false;
      enableXinerama = true;
      imageDirectory = "%h/wallpaper";
      interval = "30m";
    };

    gpg-agent = {
      defaultCacheTtl = 7200; # 2 hours
      enable = true;
      enableExtraSocket= true;
      enableScDaemon = true; # smart card support
      enableSshSupport = true;
      maxCacheTtl = 86400; # 24 hours
      pinentryFlavor = "curses";
      verbose = true;
      extraConfig = ''
        allow-emacs-pinentry
      '';
      #sshKeys = [
      #  "8278B6132877C1911B07814D94FC4F29DF23FCA4"
      #];
    };
  };

  xsession = {
    enable = true;
    windowManager = {
      xmonad = {
        enable = true;
        extraPackages = xmonadPackages;
        enableContribAndExtras = true;
        config = ./xmonad.hs;
      };
    };
  };

  programs.gpg.enable = true;
  programs = {

    git.signing.signByDefault = true;
    qutebrowser = {
      enable = true;
      settings = {
        "colors.webpage.darkmode.enabled" =
          if theme == "dark" then true else false;

        "content.user_stylesheets" = "~/.userstyles.css"; # generated in common.nix

        # attempting to fix gl rendering
        "qt.force_software_rendering" = "qt-quick";
        #"backend" = "webkit";
      };
    };

    rofi = {
      enable = true;
      pass.enable = true;
      font = "Fira Mono 16";
      theme = "purple";
      plugins = with pkgs; [
        rofi-calc
        rofi-emoji
        rofi-file-browser
        rofi-menugen
        rofi-mpd
        rofi-pass
        rofi-systemd
      ];
    };
  };

  systemd.user = {
    services = {
      #"gpg-refresh".Service.ExecStart = "${pkgs.gnupg}/bin/gpg --refresh";
      # make it the same as 'systemctl show mpd | grep LimitMEMLOCK"
      # might not be necessary?
      #mpd.Service.LimitMEMLOCK = "2085444096";
    };
    timers = {
      #"gpg-refresh" = {
      #  Install.WantedBy = ["timers.target"];
      #  Timer.OnCalendar = "daily";
      #};
    };
  };
}