{ config, lib, pkgs, hostname, userConfig, ... }: let onePassPath = if pkgs.stdenv.isDarwin then "${userConfig.homeDirectory}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" else "${userConfig.homeDirectory}/.1password/agent.sock"; ghosttyPkg = if pkgs.stdenv.isDarwin then pkgs."ghostty-bin" else pkgs.ghostty; rebuildCmd = if pkgs.stdenv.isDarwin then "darwin-rebuild" else "nixos-rebuild"; in { home.stateVersion = lib.mkDefault "26.05"; home.username = userConfig.username; home.homeDirectory = userConfig.homeDirectory; home.sessionVariables.SSH_AUTH_SOCK = onePassPath; home.sessionVariables.CLAUDE_CONFIG_DIR = "${config.xdg.configHome}/claude"; home.packages = with pkgs; [ nixd treefmt nixpkgs-fmt deadnix ]; xdg.enable = true; xdg.configHome = "${config.home.homeDirectory}/.config"; xdg.cacheHome = "${config.home.homeDirectory}/.cache"; xdg.dataHome = "${config.home.homeDirectory}/.local/share"; xdg.stateHome = "${config.home.homeDirectory}/.config/state"; xdg.configFile."ssh.conf".source = ./config.ssh.conf; xdg.configFile."1Password/ssh/agent.toml".text = '' [[ssh-keys]] item = "${userConfig._1PassKeyName}" vault = "${userConfig._1PassKeyVault}" ''; xdg.configFile."claude/settings.json".source = pkgs.writeText "claude-settings.json" ( builtins.toJSON { "$schema" = "https://json.schemastore.org/claude-code-settings.json"; theme = "dark"; agent = "plan"; denyCommands = [ "code --install-extension*" ]; additionalDirectories = [ "/tmp" ]; autoMemoryEnabled = false; effortLevel = "medium"; fastModePerSessionOptIn = true; feedbackSurveyRate = 0; model = "opusplan"; showClearContextOnPlanAccept = false; statusLine = { type = "command"; command = "claude-statusline prompt"; }; } ); xdg.configFile."claude-statusline/config.toml".text = '' format = "$directory | $git_branch | $model | $cost | $context | $usage" preset = "default" [usage] disabled = false format = 'S: {{printf "%.0f" .BlockPct}}% ({{.BlockResets}}) | W: {{printf "%.0f" .WeeklyPct}}%' ''; programs.tmux.enable = true; programs.fastfetch.enable = true; programs.zsh = { enable = true; enableCompletion = true; autosuggestion.enable = true; syntaxHighlighting.enable = true; shellAliases = { ll = "ls -l"; gst = "git status"; nix-update = "sudo ${rebuildCmd} switch --flake ~/nixos#${hostname}"; home-update = "home-manager switch --flake ~/nixos#${userConfig.username}@${hostname}"; }; }; programs.starship = { enable = true; enableZshIntegration = true; # Optional custom settings (translates to ~/.config/starship.toml) settings = { # Line 1: ➜ folder git:(branch) [status] format = "$character$directory$git_branch"; # Show current directory name only directory = { style = "bold cyan"; truncation_length = 1; truncate_to_repo = false; }; # git:(branch) styling git_branch = { format = "[git:\\([$branch](red)\\)](bold blue) "; }; # Bottom line prompt arrow character = { success_symbol = "[➜](bold green)"; error_symbol = "[➜](bold red)"; vicmd_symbol = "[➜](bold yellow)"; }; git_status = { disabled = false; }; # Nix shell indicator module configuration nix_shell = { symbol = "❄️ "; format = "via [$symbol$state]($style) "; }; }; }; programs.ssh = { enable = true; enableDefaultConfig = false; extraConfig = builtins.readFile ./config.ssh.conf; settings = { "*" = { ControlMaster = "auto"; ControlPath = "~/.ssh/master-%r@%h:%p"; ControlPersist = "10m"; IdentityAgent = "\"${onePassPath}\""; }; }; }; programs.git = { enable = true; settings = { user.name = userConfig.gitName; user.email = userConfig.gitEmail; init.defaultBranch = "main"; push.autoSetupRemote = true; pull.rebase = true; core.sshCommand = "ssh"; core.fsmonitor = true; core.untrackedCache = true; feature.manyFiles = true; index.version = 4; }; }; programs.ghostty = { enable = true; package = ghosttyPkg; enableBashIntegration = true; enableZshIntegration = true; settings = { macos-icon = "chalkboard"; keybind = [ "home=text:\\x01" # Ctrl-A -> beginning of line "end=text:\\x05" # Ctrl-E -> end of line "delete=text:\\x7f" ]; }; }; }