{ self, inputs, ... }: let username = "john"; in { flake.modules = { nixos.zsh = { pkgs, ... }: { users.users."${username}".shell = pkgs.zsh; programs.zsh.enable = true; # Already being imported by the john.nix module # home-manager.sharedModules = [ # inputs.self.modules.homeManager.zsh # ]; }; homeManager.zsh = { pkgs, config, ... }: { programs.zsh = { enable = true; package = pkgs.zsh; enableCompletion = true; autosuggestion.enable = true; # syntaxHighlighting.enable = true; initContent = "HOST=$(hostname -s)"; dotDir = "${config.xdg.configHome}/zsh"; history = { append = true; ignoreAllDups = true; ignorePatterns = [ "history" "ls" "eza" "clear" ]; save = 1000; size = 1000; share = true; }; oh-my-zsh = { enable = true; # theme = "risto"; theme = "agnoster"; plugins = [ "sudo" "dotenv" "git" "ssh" "ssh-agent" ]; }; }; }; }; perSystem = { config, self', pkgs, lib, ... }: { packages.jsl-zsh = let ignorePatterns = [ "ls" "eza" "history" "clear" ]; aliasStr = lib.concatStringsSep "\n" ( lib.mapAttrsToList (k: v: "alias -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}") { ls = "eza"; ll = "eza -l"; la = "eza -a"; lt = "eza --tree"; lla = "eza -la"; ds = "gdu -i /snap /"; }); in (inputs.wrappers.wrapperModules.zsh.apply { inherit pkgs; binName = "jsl-zsh"; env = { LANG = "en_US.UTF-8"; COLORTERM = "truecolor"; }; settings = { completion = { enable = true; extraCompletions = true; caseInsensitive = true; fuzzySearch = true; }; autoSuggestions = { enable = true; strategy = [ "history" "completion" ]; }; history = { append = true; expanded = true; share = true; ignoreAllDups = true; ignoreSpace = true; }; integrations = { fzf.enable = true; starship = { enable = true; package = self'.packages.starship; }; zoxide.enable = true; }; }; extraRC = '' HISTFILE=$HOME/.zsh_history HISTORY_IGNORE=${lib.escapeShellArg "(${lib.concatStringsSep "|" ignorePatterns})"} HOSTNAME=$(hostname -s) ${aliasStr} eval "$(direnv hook zsh)" ''; extraPackages = with pkgs; [ self'.packages.my-eza self'.packages.gdu busybox fd ripgrep hostname iproute2 direnv ]; }).wrapper; packages.starship = (inputs.wrappers.wrapperModules.starship.apply { inherit pkgs; settings = lib.mkMerge [ (lib.importTOML (pkgs.fetchurl { url = https://starship.rs/presets/toml/catppuccin-powerline.toml; sha256 = "0bd8zx0bpri63rnb9dva0rav75d3i2wrzw44h63m75hq5220r26g"; })) { palette = "catppuccin_mocha"; add_newline = lib.mkForce true; line_break.disabled = lib.mkForce false; git_status.diverged = lib.mkForce "⇕⇡\${ahead_count}⇣\${behind_count}"; cmd_duration.format = lib.mkForce "󰔛 $duration"; python.disabled = lib.mkForce true; } ]; }).wrapper; packages.gdu = inputs.wrappers.lib.wrapPackage { inherit pkgs; package = pkgs.gdu; args = [ "-x" "--si" "--collapse-path" "--mouse" "$@" ]; }; }; }