From b8c758615bdebcdd232cf6dc3632a325af88a1cd Mon Sep 17 00:00:00 2001 From: Yadunand Prem Date: Mon, 18 Aug 2025 13:38:40 +0800 Subject: [PATCH] Migrate Zsh config --- flake.nix | 2 +- .../yadunut@yadunut-mbp/default.nix | 68 ++++++++++++++ modules/home/zsh/default.nix | 90 +++++++++++++++++++ 3 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 homes/aarch64-darwin/yadunut@yadunut-mbp/default.nix create mode 100644 modules/home/zsh/default.nix diff --git a/flake.nix b/flake.nix index 9bfae31..5ad0476 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Yadunand's Configuration"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; snowfall-lib = { url = "github:snowfallorg/lib"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/homes/aarch64-darwin/yadunut@yadunut-mbp/default.nix b/homes/aarch64-darwin/yadunut@yadunut-mbp/default.nix new file mode 100644 index 0000000..7a2d718 --- /dev/null +++ b/homes/aarch64-darwin/yadunut@yadunut-mbp/default.nix @@ -0,0 +1,68 @@ +{ + lib, + pkgs, + config, + ... +}: +{ + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing. + + home.packages = [ + # pkgs.dive + pkgs.entr + pkgs.lazygit + pkgs.jq + pkgs.just + pkgs.rsync + pkgs.gh + pkgs.claude-code + pkgs.devenv + pkgs.jujutsu + pkgs.dive + ]; + + home.sessionVariables = { + JAVA_HOME = "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home"; + ANDROID_HOME = "$HOME/Library/Android/sdk"; + }; + + home.sessionPath = [ + "$ANDROID_HOME/emulator" + "$ANDROID_HOME/platform-tools" + "/opt/homebrew/bin" + ]; + + programs.zsh.shellAliases = { + lg = "lazygit"; + }; + + zsh.enable = true; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + programs.git.extraConfig = { + gpg.ssh.program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"; + user.signingkey = "~/.ssh/yadunut_ed25519.pub"; + core.excludesFile = "~/.gitignore_global"; + }; + + programs.gh = { + enable = true; + }; + + targets.darwin = { + defaults."com.apple.dock".autohide = true; + defaults."com.apple.finder".AppleShowAllFiles = true; + defaults.NSGlobalDomain.AppleShowAllExtensions = true; + defaults.NSGlobalDomain.KeyRepeat = 2; + defaults.NSGlobalDomain.ApplePressAndHoldEnabled = false; + }; +} diff --git a/modules/home/zsh/default.nix b/modules/home/zsh/default.nix new file mode 100644 index 0000000..d230dfe --- /dev/null +++ b/modules/home/zsh/default.nix @@ -0,0 +1,90 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: +let + cfg = config.zsh; + inherit (lib) mkEnableOption mkIf mkOption; +in +{ + options.zsh = { + enable = mkEnableOption "Zsh"; + }; + + config = mkIf cfg.enable { + + home.packages = with pkgs; [ + zsh-completions + fd + htop + ripgrep + wget + delta + ]; + + programs.bat = { + enable = true; + }; + + programs.dircolors = { + enable = true; + enableZshIntegration = true; + }; + + programs.direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + config = { + hide_env_diff = true; + }; + }; + programs.zsh = { + enable = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + autosuggestion.enable = true; + autocd = true; + history = { + size = 1000000; + extended = true; + append = true; + expireDuplicatesFirst = true; + ignoreDups = true; + ignoreAllDups = true; + ignoreSpace = true; + }; + historySubstringSearch.enable = true; + shellAliases = { + cat = "bat --theme=\"$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo 'gruvbox-dark' || echo 'gruvbox-light')\""; + diff = "delta"; + }; + }; + programs.fzf.enable = true; + programs.fzf.enableZshIntegration = true; + + programs.zoxide.enable = true; + programs.zoxide.enableZshIntegration = true; + + programs.eza = { + enable = true; + enableZshIntegration = true; + extraOptions = [ "--group-directories-first" ]; + }; + + programs.starship = { + enable = true; + enableZshIntegration = true; + settings = { + nodejs.disabled = true; + package.disabled = true; + aws.disabled = true; + python.disabled = true; + }; + }; + }; + +}