users/ryan/home.nix

1a71e94eb8ca1585201263cf654611ef6849d359 · 5.3 KB · 204 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 programs.zsh = {
110 enable = true;
111 initContent = let
112 brewPath = if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64 then ''
113 eval "$(/opt/homebrew/bin/brew shellenv)"
114 '' else "";
115 in ''
116 export GPG_TTY="$(tty)"
117 export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
118 gpgconf --launch gpg-agent
119 gpg-connect-agent updatestartuptty /bye > /dev/null
120 ${brewPath}
121 '';
122 shellAliases = {
123 cat = "bat --paging=never";
124 diff = "delta";
125 rebuild = "sudo darwin-rebuild switch --flake ~/.config/nix/.";
126 };
127 };
128
129 # The home.packages option allows you to install Nix packages into your
130 # environment.
131 home.packages = with pkgs; [
132 git
133 yt-dlp
134 aerc
135 gdu
136 taskwarrior3
137 delta
138 bat
139 pass
140 pandoc
141 iina # Media player (frontend to mpv essentially)
142 kubectl
143 talhelper
144 talosctl
145 audacity
146 ffmpeg
147 blender
148 ];
149
150 # Home Manager is pretty good at managing dotfiles. The primary way to manage
151 # plain files is through 'home.file'.
152 home.file = {
153 # # Building this configuration will create a copy of 'dotfiles/screenrc' in
154 # # the Nix store. Activating the configuration will then make '~/.screenrc' a
155 # # symlink to the Nix store copy.
156 # ".screenrc".source = dotfiles/screenrc;
157
158 # # You can also set the file content immediately.
159 # ".gradle/gradle.properties".text = ''
160 # org.gradle.console=verbose
161 # org.gradle.daemon.idletimeout=3600000
162 # '';
163 };
164
165 # Install User apps to subdir for dock stuff
166 targets.darwin.linkApps.directory = "Applications/User Apps";
167
168 # Symlink System apps into the user apps "system" dir
169 home.activation.linkSystemApps = lib.mkIf pkgs.stdenv.isDarwin (
170 lib.hm.dag.entryAfter ["writeBoundary"] ''
171 if [[ -z "$HOME" ]]; then
172 echo "ERROR: HOME was not defined. This should not happen. Bailing! ">&2
173 exit 1
174 fi
175
176 $DRY_RUN_CMD mkdir -p "$HOME/Applications/System Apps"
177
178 $DRY_RUN_CMD rm -rf "$HOME/Applications/System Apps/"*.app
179
180 $DRY_RUN_CMD find /Applications /System/Applications -maxdepth 2 -name "*.app" \
181 -prune -exec ln -sf {} "$HOME/Applications/System Apps/" \;
182 ''
183 );
184
185 # Restart gpg-agent
186 home.activation.restartGpgAgent = lib.mkIf pkgs.stdenv.isDarwin (
187 lib.hm.dag.entryAfter ["writeBoundary"] ''
188 $DRY_RUN_CMD ${pkgs.gnupg}/bin/gpgconf --kill gpg-agent || true
189 ''
190 );
191
192 xdg.configFile."aerc" = {
193 source = ./aerc;
194 recursive = true;
195 };
196
197 home.sessionVariables = {
198 XDG_CONFIG_HOME = "${config.home.homeDirectory}/.config";
199 EDITOR = "${pkgs.neovim}/bin/nvim";
200 };
201
202 # Let Home Manager install and manage itself.
203 programs.home-manager.enable = true;
204 }