users/ryan/home.nix

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