{ pkgs, email, name, sshSignKey, ... }: let in { atuin.enable = true; bat.enable = true; direnv = { enable = true; enableNushellIntegration = true; nix-direnv.enable = true; }; eza = { enable = true; }; gh = { enable = true; settings = { git_protocol = "ssh"; version = 1; }; }; git = { enable = true; aliases = { co = "checkout"; l = "log --graph --decorate --pretty=oneline --abbrev-commit"; prune = "fetch --prune"; stash-all = "stash save --include-untracked"; s = "status"; }; ignores = [ ".DS_Store" ".svn" "*~" "*.swp" "*.rbc" ".idea/" "__pycache__/" ".vscode" ".clangd/" ".direnv/" "compile_commands.json" "*.sublime-project" "*.sublime-workspace" "build.nosync/" ".cache/" ]; userName = name; userEmail = email; lfs.enable = true; extraConfig = { init.defaultBranch = "develop"; pull.ff = true; push.default = "simple"; rebase.autoStash = true; credential.helper = "osxkeychain"; commit.gpgsign = true; gpg.format = "ssh"; user.signingkey = sshSignKey; }; }; jujutsu = { enable = true; settings = { signing = { sign-all = true; backend = "ssh"; key = sshSignKey; }; user = { inherit email name; }; ui.editor = "zed -w"; }; }; kitty = { darwinLaunchOptions = [ "--single-instance" ]; enable = true; font = { name = "Berkeley Mono Variable Nerd Font"; size = 14; }; settings = { cursor_shape = "underline"; confirm_os_window_close = 0; }; themeFile = "Catppuccin-Latte"; }; # Shared shell configuration nushell = { enable = true; shellAliases = { edit = "^($env.VISUAL)"; start = "^open"; less = "bat"; set-light-theme = "kitty +kitten themes GitHub Dark"; set-dark-theme = "kitty +kitten themes GitHub Light"; brew-backup = "brew bundle dump --global --no-lock --formula --cask --mas --tap --force"; brew-cleanup = "brew bundle cleanup --global --no-lock --force --zap"; brew-restore = "brew bundle install --global --no-lock"; }; environmentVariables = { # Set default editor EDITOR = ''"nvim"''; VISUAL = ''"codium"''; # DISABLE VI INDICATORS PROMPT_INDICATOR_VI_INSERT = ''""''; PROMPT_INDICATOR_VI_NORMAL = ''""''; # Alias for Monash compute cluster OPTCLUSTER = ''"compute.optimisation-2020.cloud.edu.au"''; # CMake settings CMAKE_EXPORT_COMPILE_COMMANDS = ''"1"''; # output compile-commands.json for clangd CMAKE_GENERATOR = ''"Ninja Multi-Config"''; # use Ninja generator by default CMAKE_C_COMPILER_LAUNCHER = ''"ccache"''; CMAKE_CXX_COMPILER_LAUNCHER = ''"ccache"''; # Homebrew shell setup (brew shellenv) HOMEBREW_PREFIX = ''"/opt/homebrew"''; HOMEBREW_CELLAR = ''"/opt/homebrew/Cellar"''; HOMEBREW_REPOSITORY = ''"/opt/homebrew"''; INFOPATH = ''"/opt/homebrew/share/info"''; # Set MANPATH MANPATH = ''"/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/opt/homebrew/share/man"''; NIX_PROFILES = ''$"/nix/var/nix/profiles/default:($env.HOME)/.nix-profile"''; }; envFile.text = '' if not 'config' in $env { $env.config = ([] | into record) } $env.config = ($env.config | upsert show_banner false) $env.config = ($env.config | upsert rm.always_trash true) $env.config = ($env.config | upsert edit_mode vi) $env.config = ($env.config | upsert history.max_size 100000) $env.config = ($env.config | upsert footer_mode auto) $env.config = ($env.config | upsert history.file_format "sqlite") ''; configFile.text = '' # Specifies how environment variables are: # - converted from a string to a value on Nushell startup (from_string) # - converted from a value back to a string when running external commands (to_string) # Note: The conversions happen *after* config.nu is loaded $env.ENV_CONVERSIONS = { "PATH": { from_string: { |s| $s | split row (char esep) | path expand --no-symlink } to_string: { |v| $v | path expand --no-symlink | str join (char esep) } } } # Add entries to PATH: # From MacOS helper (/usr/libexec/path_helper) $env.PATH = ($env.PATH | split row (char esep) | append $"($env.HOME)/.nix-profile/bin") $env.PATH = ($env.PATH | split row (char esep) | append "/nix/var/nix/profiles/default/bin") $env.PATH = ($env.PATH | split row (char esep) | append "/Library/TeX/texbin") $env.PATH = ($env.PATH | split row (char esep) | append "/Library/Apple/usr/bin") $env.PATH = ($env.PATH | split row (char esep) | append "/opt/homebrew/bin") $env.PATH = ($env.PATH | split row (char esep) | append "/opt/homebrew/sbin") $env.PATH = ($env.PATH | split row (char esep) | append "/usr/local/bin") # Other package managers $env.PATH = ($env.PATH | split row (char esep) | prepend $"($env.HOME)/.local/bin") $env.PATH = ($env.PATH | split row (char esep) | prepend $"($env.HOME)/.cargo/bin") ''; }; ssh = { enable = true; matchBlocks = { optimization = { hostname = "compute.optimisation-2020.cloud.edu.au"; user = "dekker1"; }; nitrogen = { hostname = "nitrogen.dekker.li"; user = "jdekker"; }; m3 = { hostname = "m3-login3.massive.org.au"; user = "jdekker"; }; }; }; starship = { enable = true; settings = (with builtins; fromTOML (readFile ./config/starship-tokyo-night.toml)) // { # Overrides }; }; topgrade = { enable = true; settings = { misc.disable = [ "brew_cask" # "brew_formula" "containers" "gem" "node" "pnpm" "ruby_gems" "tlmgr" "vim" "yarn" ]; misc.assume_yes = true; misc.cleanup = true; misc.no_retry = true; pre_commands = { "Home Manager" = "(cd ~/nix-config/ && nix flake update) && darwin-rebuild switch --flake ~/nix-config#aarch64-darwin"; }; }; }; vscode = { enable = false; package = pkgs.vscodium; }; zoxide = { enable = true; enableNushellIntegration = true; }; zsh = { enable = true; autocd = true; defaultKeymap = "viins"; shellAliases = { edit = "$VISUAL"; start = "open"; less = "bat"; ls = "eza"; }; sessionVariables = { # Set default editor EDITOR = "nvim"; VISUAL = "codium"; # CMake settings CMAKE_EXPORT_COMPILE_COMMANDS = "1"; # output compile-commands.json for clangd CMAKE_GENERATOR = "Ninja Multi-Config"; # use Ninja generator by default CMAKE_C_COMPILER_LAUNCHER = "sccache"; CMAKE_CXX_COMPILER_LAUNCHER = "sccache"; # Rust settings RUSTC_WRAPPER = "sccache"; }; initExtra = '' # Load Homebrew shell environment if [[ -f "/opt/homebrew/bin/brew" && -x $(realpath "/opt/homebrew/bin/brew") ]]; then eval "$(/opt/homebrew/bin/brew shellenv)" elif [[ -f "/usr/local/bin/brew" && -x $(realpath "/usr/local/bin/brew") ]]; then eval "$(/usr/local/bin/brew shellenv)" fi ''; }; }