users/ryan/home.nix

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