users/ryan/home.nix

8d7aa6e03293de5432a33e6ed55f3f4b2a4f095c · 5.3 KB · 208 lines raw

1 { config, pkgs, lib, ... }:
2
3 {
4 # This value determines the Home Manager release that your configuration is
5 # compatible with. This helps avoid breakage when a new Home Manager release
6 # introduces backwards incompatible changes.
7 #
8 # You should not change this value, even if you update Home Manager. If you do
9 # want to update the value, then make sure to first check the Home Manager
10 # release notes.
11 imports = [ ./modules ];
12 home.stateVersion = "26.05"; # Please read the comment before changing.
13
14 news.display = "silent";
15
16 # My own modules
17 ryan.neovim.enable = true;
18 ryan.sketchybar.enable = true;
19
20 programs.starship = {
21 enable = true;
22 settings = {
23 add_newline = false;
24 character = {
25 success_symbol = "[➜](bold green)";
26 error_symbol = "[➜](bold red)";
27 };
28 time = {
29 disabled = false;
30 format = "\[ $time \]($style)";
31 time_format = "%T";
32 };
33 };
34 };
35
36 programs.zen-browser = {
37 enable = true;
38 package = null; # managed via homebrew
39 darwinDefaultsId = "app.zen-browser.zen";
40 policies = import ./zen/zenPolicies.nix;
41 profiles.default = import ./zen/zenProfile.nix;
42 };
43
44 programs.eza = {
45 enable = true;
46 enableZshIntegration = true;
47 };
48
49 programs.gpg.enable = true;
50
51 programs.git = {
52 enable = true;
53 signing.signByDefault = true;
54 settings = {
55 user = {
56 name = "Ryan Schanzenbacher";
57 email = "ryan@rschanz.org";
58 };
59 core.pager = "${pkgs.delta}/bin/delta";
60 init.defaultBranch = "main";
61 merge.conflictStyle = "zdiff3";
62 interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only";
63 delta = {
64 navigate = true;
65 side-by-side = true;
66 };
67 };
68 };
69
70 programs.ssh = {
71 enable = true;
72 package = null; # installed by default
73
74 enableDefaultConfig = false;
75
76 settings = {
77 "rocApex" = {
78 hostname = "129.158.232.104";
79 user = "root";
80 };
81 "hetzner" = {
82 hostname = "5.161.207.21";
83 user = "root";
84 };
85 "rncorepub" = {
86 hostname = "5.161.89.186";
87 user = "root";
88 };
89 };
90 };
91
92
93
94 services.gpg-agent = {
95 enable = pkgs.stdenv.isLinux;
96 enableSshSupport = true;
97 };
98
99 # Need special config for gpg-agent on macOS
100 home.file.".gnupg/gpg-agent.conf" = lib.mkIf pkgs.stdenv.isDarwin {
101 text = ''
102 pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac
103 enable-ssh-support
104 '';
105 };
106
107 # Add hammerspoon if on mac
108 home.file.".hammerspoon".source = lib.mkIf pkgs.stdenv.isDarwin ./hammerspoon;
109
110 programs.zsh = {
111 enable = true;
112 initContent = let
113 brewPath = if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64 then ''
114 eval "$(/opt/homebrew/bin/brew shellenv)"
115 '' else "";
116 in ''
117 export GPG_TTY="$(tty)"
118 export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
119 gpgconf --launch gpg-agent
120 gpg-connect-agent updatestartuptty /bye > /dev/null
121 ${brewPath}
122 '';
123 shellAliases = {
124 cat = "bat --paging=never";
125 diff = "delta";
126 rebuild = "sudo darwin-rebuild switch --flake ~/.config/nix/.";
127 };
128 };
129
130 # The home.packages option allows you to install Nix packages into your
131 # environment.
132 home.packages = with pkgs; [
133 git
134 yt-dlp
135 aerc
136 gdu
137 taskwarrior3
138 delta
139 bat
140 pass
141 pandoc
142 iina # Media player (frontend to mpv essentially)
143 kubectl
144 talhelper
145 talosctl
146 audacity
147 ffmpeg
148 blender
149 nerd-fonts.anonymice
150 jujutsu
151 netbird-tui
152 ];
153
154 # Home Manager is pretty good at managing dotfiles. The primary way to manage
155 # plain files is through 'home.file'.
156 home.file = {
157 # # Building this configuration will create a copy of 'dotfiles/screenrc' in
158 # # the Nix store. Activating the configuration will then make '~/.screenrc' a
159 # # symlink to the Nix store copy.
160 # ".screenrc".source = dotfiles/screenrc;
161
162 # # You can also set the file content immediately.
163 # ".gradle/gradle.properties".text = ''
164 # org.gradle.console=verbose
165 # org.gradle.daemon.idletimeout=3600000
166 # '';
167 };
168
169 # Install User apps to subdir for dock stuff
170 targets.darwin.linkApps.directory = "Applications/User Apps";
171
172 # Symlink System apps into the user apps "system" dir
173 home.activation.linkSystemApps = lib.mkIf pkgs.stdenv.isDarwin (
174 lib.hm.dag.entryAfter ["writeBoundary"] ''
175 if [[ -z "$HOME" ]]; then
176 echo "ERROR: HOME was not defined. This should not happen. Bailing! ">&2
177 exit 1
178 fi
179
180 $DRY_RUN_CMD mkdir -p "$HOME/Applications/System Apps"
181
182 $DRY_RUN_CMD rm -rf "$HOME/Applications/System Apps/"*.app
183
184 $DRY_RUN_CMD find /Applications /System/Applications -maxdepth 2 -name "*.app" \
185 -prune -exec ln -sf {} "$HOME/Applications/System Apps/" \;
186 ''
187 );
188
189 # Restart gpg-agent
190 home.activation.restartGpgAgent = lib.mkIf pkgs.stdenv.isDarwin (
191 lib.hm.dag.entryAfter ["writeBoundary"] ''
192 $DRY_RUN_CMD ${pkgs.gnupg}/bin/gpgconf --kill gpg-agent || true
193 ''
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 # Let Home Manager install and manage itself.
207 programs.home-manager.enable = true;
208 }