users/ryan/common.nix

cabf188ae487120d4b9ac1fe21fff45403a787b4 · 4.9 KB · 207 lines raw

1 { config, pkgs, lib, ... }:
2
3 {
4 imports = [ ./modules/nvim ];
5
6 news.display = "silent";
7
8 # Keep everything in lockstep
9 home.stateVersion = "26.05";
10
11 # My own modules
12 ryan.neovim.enable = true;
13
14 programs.starship = {
15 enable = true;
16 settings = {
17 add_newline = false;
18 character = {
19 success_symbol = "[➜](bold green)";
20 error_symbol = "[➜](bold red)";
21 };
22 time = {
23 disabled = false;
24 format = "\[ $time \]($style)";
25 time_format = "%T";
26 };
27 };
28 };
29
30 # Package/platform overrides (darwinDefaultsId, package = null for homebrew,
31 # etc.) live in darwin.nix/linux.nix. Policies/profile are shared.
32 programs.zen-browser = {
33 enable = true;
34 policies = import ./zen/zenPolicies.nix;
35 profiles.default = import ./zen/zenProfile.nix;
36 };
37
38 programs.eza = {
39 enable = true;
40 enableZshIntegration = true;
41 };
42
43 programs.gpg.enable = true;
44
45 programs.git = {
46 enable = true;
47 signing.signByDefault = true;
48 settings = {
49 user = {
50 name = "Ryan Schanzenbacher";
51 email = "ryan@rschanz.org";
52 };
53 core.pager = "${pkgs.delta}/bin/delta";
54 init.defaultBranch = "main";
55 merge.conflictStyle = "zdiff3";
56 interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only";
57 delta = {
58 navigate = true;
59 side-by-side = true;
60 };
61 # Merged from guix-dotfiles' ~/.gitconfig - git-lfs filter and
62 # git send-email settings, missing from the darwin config until now.
63 filter.lfs = {
64 clean = "git-lfs clean -- %f";
65 smudge = "git-lfs smudge -- %f";
66 process = "git-lfs filter-process";
67 required = true;
68 };
69 sendemail = {
70 smtpserver = "mail.rschanz.org";
71 smtpuser = "ryan@rschanz.org";
72 smtpencryption = "ssl";
73 smtpserverport = 465;
74 };
75 };
76 };
77
78 programs.ssh = {
79 enable = true;
80 package = null; # installed by default
81
82 enableDefaultConfig = false;
83
84 settings = {
85 "rocApex" = {
86 hostname = "129.158.232.104";
87 user = "root";
88 };
89 "hetzner" = {
90 hostname = "5.161.207.21";
91 user = "root";
92 };
93 "rncorepub" = {
94 hostname = "5.161.89.186";
95 user = "root";
96 };
97 # Merged from guix-dotfiles' ~/.ssh/config - hosts and quirks missing
98 # from the darwin config until now.
99 "linode" = {
100 hostname = "97.107.142.58";
101 user = "root";
102 };
103 # `settings` has a freeform type, so upstream ssh_config directive
104 # names can be set directly - `programs.ssh.settings.*.extraOptions`
105 # is explicitly unsupported (hard assertion failure) in this HM version.
106 "192.168.216.1" = {
107 HostKeyAlgorithms = "+ssh-rsa";
108 PubkeyAcceptedAlgorithms = "+ssh-rsa";
109 };
110 "*" = {
111 KexAlgorithms = "-sntrup761x25519-sha512@openssh.com";
112 };
113 };
114
115 extraConfig = ''
116 Match host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye"
117 '';
118 };
119
120 services.gpg-agent = {
121 enable = pkgs.stdenv.isLinux;
122 enableSshSupport = true;
123 };
124
125 programs.zsh = {
126 enable = true;
127 initContent = let
128 brewPath = if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64 then ''
129 eval "$(/opt/homebrew/bin/brew shellenv)"
130 '' else "";
131 in ''
132 export GPG_TTY="$(tty)"
133 export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
134 gpgconf --launch gpg-agent
135 gpg-connect-agent updatestartuptty /bye > /dev/null
136 ${brewPath}
137 '';
138 shellAliases = {
139 cat = "bat --paging=never";
140 diff = "delta";
141 brew = "env -u XDG_CONFIG_HOME brew";
142 grep = "grep --color=auto";
143 ll = "ls -l";
144 rebuild =
145 if pkgs.stdenv.isDarwin
146 then "sudo darwin-rebuild switch --flake ~/.config/nix/."
147 else "home-manager switch --flake ~/.config/home-manager/#ryan";
148 };
149 plugins = [
150 {
151 name = "zsh-vi-mode";
152 src = "${pkgs.zsh-vi-mode}/share/zsh-vi-mode";
153 }
154 ];
155 };
156
157 # Shared across darwin and linux; the guix side already deferred these
158 # packages to nix (all commented out of home-configuration.scm's package
159 # list), same as the darwin config always has.
160 home.packages = with pkgs; [
161 bat
162 fd
163 fzf
164 tmux
165 restic
166 rsync
167 pv
168 jq
169 htop
170 (pkgs.zathura.override {
171 plugins = [ pkgs.zathuraPkgs.zathura_pdf_mupdf ];
172 })
173 go
174 pass
175 file
176 pandoc
177 weechat
178 python3
179 yt-dlp
180 aerc
181 gdu
182 taskwarrior3
183 delta
184 prismlauncher
185 git-lfs
186 kdePackages.kdenlive
187 audacity
188 blender
189
190 nerd-fonts.anonymice
191 nerd-fonts.monofur
192 nerd-fonts.lilex
193 nerd-fonts.fira-code
194 ];
195
196 xdg.configFile."aerc" = {
197 source = ./aerc;
198 recursive = true;
199 };
200
201 home.sessionVariables = {
202 XDG_CONFIG_HOME = "${config.home.homeDirectory}/.config";
203 EDITOR = "${pkgs.neovim}/bin/nvim";
204 };
205
206 programs.home-manager.enable = true;
207 }