about summary refs log tree commit diff
path: root/hosts/home.nix
blob: 9bd5f9dafa054cb33ad519d07cb81d469884c871 (plain) (blame)
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
{ config, lib, pkgs, inputs, user, hostname, secrets, dotfiles, location, ... }:
{
  imports = [
    ../modules/email
  ];

  home = {
    username = "${user}";
    homeDirectory = "/home/${user}";

    packages = with pkgs; [
      scrot
      redshift
      discord
      mpv
      sxiv
      #dwm
      st
      dmenu
      unclutter
      clipmenu
      dunst
      sxhkd
      zathura
      feh
      pavucontrol
      polkit_gnome
      nixpkgs-fmt
      virt-manager
      xmonadctl
      xdotool #needed for xmobar clickable workspaces
      xlockmore
      arandr
      jrnl
      todo-txt-cli
      element-desktop
      speedtest-cli
      libnotify
      dwmbar
      manga-cli
      mov-cli
      smart-wallpaper
      waybar
      wl-clipboard
      sway
      swayidle
      swaylock-effects
      swaybg
      river
      wlr-randr
      wlsunset
    ] ++
    (with pkgs.custom; [
      lemacs
    ]);
  };

  xsession.windowManager.xmonad = {
    enable = true;
    enableContribAndExtras = true;
    config = "${dotfiles}/xmonad.hs";
  };

  programs = {
    xmobar = {
      enable = true;
      extraConfig = builtins.readFile "${dotfiles}/xmobar.hs";
    };
  };

  home.sessionVariables = {
    LOCATION = "${location}";
  };

  services = {
    gpg-agent = {
      enable = true;
      enableSshSupport = true;
      sshKeys = [ "BC10A40920B576F641480795B9C7E01A4E47DA9F" ];
      defaultCacheTtl = 43200; #12h
      defaultCacheTtlSsh = 43200;
      maxCacheTtl = 86400; #24h
      maxCacheTtlSsh = 86400;
    };

    emacs = {
      enable = true;
      startWithUserSession = true;
    };

    screen-locker = {
      enable = true;
      lockCmd = "${pkgs.xlockmore}/bin/xlock +resetsaver -dpmsoff 5 -mode blank";
      xautolock.enable = false;
    };
  };

  programs = {
    git = {
      enable = true;
      package = pkgs.gitFull;
      userName = "Baitinq";
      userEmail = "manuelpalenzuelamerino@gmail.com";
      signing = {
        signByDefault = true;
        key = "18BE4F736F27FC190C1E1000BB3C0BC698650937";
      };
      extraConfig = {
        push.autoSetupRemote = true;
        init.defaultBranch = "master";
        sendemail = {
          smtpserver = "smtp.gmail.com";
          smtpserverport = "587";
          smtpencryption = "tls";
          smtpuser = "manuelpalenzuelamerino@gmail.com";
          smtpPass = secrets.email."manuelpalenzuelamerino@gmail.com".password;
        };
      };
    };

    direnv = {
      enable = true;
      nix-direnv.enable = true;
    };

    emacs = {
      enable = true;
      extraPackages = epkgs: with epkgs; [
        use-package

        direnv

        evil
        evil-collection

        doom-modeline
        dashboard

        lsp-ui
        projectile

        lsp-mode
        company
        lsp-haskell

        nix-mode
        haskell-mode
        typescript-mode
        jq-mode

        doom-themes
      ];
      extraConfig = builtins.readFile "${dotfiles}/.emacs";
    };

    firefox = {
      enable = true;
      extensions = with pkgs.nur.repos.rycee.firefox-addons; [
        ublock-origin
        darkreader
        https-everywhere
        h264ify
      ];
      profiles.default = {
        id = 0;
        name = "Default";
        isDefault = true;
        settings = {
          "general.autoScroll" = true;
        };
      };
    };

    rtorrent = { enable = true; };

    obs-studio = { enable = true; };

    bash = {
      enable = true;
      bashrcExtra = builtins.readFile "${dotfiles}/.bashrc";
      profileExtra = builtins.readFile "${dotfiles}/.bash_profile";
    };

    zsh = {
      enable = true;

      oh-my-zsh.enable = true;

      plugins = [
        {
          # will source zsh-autosuggestions.plugin.zsh
          name = "zsh-autosuggestions";
          src = pkgs.fetchFromGitHub {
            owner = "zsh-users";
            repo = "zsh-autosuggestions";
            rev = "v0.7.0";
            sha256 = "sha256-KLUYpUu4DHRumQZ3w59m9aTW6TBKMCXl2UcKi4uMd7w=";
          };
        }
        {
          name = "zsh-256color";
          src = pkgs.fetchFromGitHub {
            owner = "chrissicool";
            repo = "zsh-256color";
            rev = "9d8fa1015dfa895f2258c2efc668bc7012f06da6";
            sha256 = "sha256-Qd9pjDSQk+kz++/UjGVbM4AhAklc1xSTimLQXxN57pI=";
          };
        }
        {
          name = "zsh-syntax-highlighting";
          src = pkgs.fetchFromGitHub {
            owner = "zsh-users";
            repo = "zsh-syntax-highlighting";
            rev = "0.7.0";
            sha256 = "sha256-eRTk0o35QbPB9kOIV0iDwd0j5P/yewFFISVS/iEfP2g=";
          };
        }
        {
          name = "agnoster-nanof";
          file = "agnoster-nanof.zsh-theme";
          src = pkgs.fetchFromGitHub {
            owner = "fsegouin";
            repo = "oh-my-zsh-agnoster-mod-theme";
            rev = "46832da7156a4cd67e9b7ed245bb2782c690b8bb";
            sha256 = "sha256-hCG/N0AbjAxDLbMo+lLpf6SKyx5Athru84nWL/3spb4=";
          };
        }
      ];

      shellAliases = {
        ls = "ls --color";
        l = "ls -l";
        ll = "ls -la";
        weather = "(){ curl -s v2.wttr.in/$1 }";
        vim = "nvim";
        q = "exit";
        c = "clear";
        "," = ", --database '/etc/nix-index'";
        extract = ''
          () {
            if [ -f $1 ] ; then
              case $1 in
                *.tar.bz2)   tar xvjf $1    ;;
                *.tar.gz)    tar xvzf $1    ;;
                *.tar.xz)    tar Jxvf $1    ;;
                *.bz2)       bunzip2 $1     ;;
                *.rar)       rar x $1       ;;
                *.gz)        gunzip $1      ;;
                *.tar)       tar xvf $1     ;;
                *.tbz2)      tar xvjf $1    ;;
                *.tgz)       tar xvzf $1    ;;
                *.zip)       unzip -d `echo $1 | sed 's/\(.*\)\.zip/\1/'` $1;;
                *.Z)         uncompress $1  ;;
                *.7z)        7z x $1        ;;
                *)           echo "don't know how to extract '$1'" ;;
              esac
            else
              echo "'$1' is not a valid file!"
            fi
          }'';
      };

      initExtra = ''
        autoload -U history-search-end #needed for -end
        zle -N history-beginning-search-backward-end history-search-end
        zle -N history-beginning-search-forward-end history-search-end

        #when going up go up only beggining of curr word history
        bindkey '\e[A' history-beginning-search-backward-end
        bindkey '\e[B' history-beginning-search-forward-end
        #ctrl + arrow forward/backward word
        bindkey "^[[1;5C" forward-word
        bindkey "^[[1;5D" backward-word
        #alt + arrow forward/backward word
        bindkey "^[[1;3C" forward-word
        bindkey "^[[1;3D" backward-word
        #alt + delete delete whole word
        bindkey "\e\x7f" backward-kill-word
      '';
    };

  };

  xdg = {
    configFile."sway/config".source = "${dotfiles}/sway_config";
    configFile."river/".source = "${dotfiles}/river/";
    configFile."waybar/".source = "${dotfiles}/waybar/";
    configFile."zathura/zathurarc".source = "${dotfiles}/zathurarc";
    configFile."dunst/dunstrc".source = "${dotfiles}/dunstrc";
  };

  home.file = {
    ".xinitrc".source = "${dotfiles}/.xinitrc";
    ".Xresources".source = "${dotfiles}/.Xresources";

    ".scripts/".source = "${dotfiles}/scripts/";
  };

  home.file = {
    "./Images/Wallpapers".source = inputs.wallpapers;
  };

  # For disabling the automatic creation of $HOME/Desktop
  xdg.userDirs.desktop = "$HOME/";

  home.stateVersion = "22.05";

}