users/ryan/home.nix
9cb45d050939b499e8e01ec9e4fe9be998d98dc4
· 5.3 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.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 | ]; |
| 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 | } |