diff --git a/parts/pkgs/default.nix b/parts/pkgs/default.nix index c3b2219..88caa9d 100644 --- a/parts/pkgs/default.nix +++ b/parts/pkgs/default.nix @@ -1,4 +1,8 @@ -{inputs, inputs', ...}: { +{ + inputs, + inputs', + ... +}: { # NOTE: We use flake-parts' easyOverlay module to extend our default packages with some extra packages I want to have. # imports = [inputs.flake-parts.flakeModules.easyOverlay]; @@ -20,7 +24,6 @@ overlayAttrs = config.packages; packages = { - nushell = import ./extraPackages/nushell {inherit inputs lib pkgs;}; fish = import ./extraPackages/fish {inherit inputs lib pkgs;}; helix = import ./extraPackages/helix-wrapped.nix {inherit inputs inputs' lib pkgs;}; }; diff --git a/parts/pkgs/extraPackages/nushell/config.nu b/parts/pkgs/extraPackages/nushell/config.nu deleted file mode 100644 index 78f3b0e..0000000 --- a/parts/pkgs/extraPackages/nushell/config.nu +++ /dev/null @@ -1,105 +0,0 @@ -let starship_installed = not (which starship | is-empty) -let direnv_installed = not (which direnv | is-empty) -let carapace_installed = not (which carapace | is-empty) - -alias c = clear -alias cc = cd; clear -alias h = hx -alias e = emacsclient -alias g = git -alias lg = lazygit -# alias cd = z -# alias ci = zi - - -let zoxide_completer = {|spans| - $spans | skip 1 | zoxide query -l ...$in | lines | where {|x| $x != $env.PWD} -} - -# ============================================================================= -let carapace_completer = {|spans: list| - carapace $spans.0 nushell ...$spans - | from json - | if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null } -} - -# ============================================================================= -let fish_completer = {|spans| - fish --command $'complete "--do-complete=($spans | str join " ")"' - | $"value(char tab)description(char newline)" + $in - | from tsv --flexible --no-infer -} - -# ============================================================================= -# This completer will use carapace by default -let external_completer = {|spans| - let expanded_alias = scope aliases - | where name == $spans.0 - | get -i 0.expansion - - let spans = if $expanded_alias != null { - $spans - | skip 1 - | prepend ($expanded_alias | split row ' ' | take 1) - } else { - $spans - } - - match $spans.0 { - # carapace completions are incorrect for nu - nu => $fish_completer - # fish completes commits and branch names in a nicer way - git => $fish_completer - # carapace doesn't have completions for asdf - # asdf => $fish_completer - # use zoxide completions for zoxide commands - __zoxide_z | __zoxide_zi => $zoxide_completer - _ => $carapace_completer - } | do $in $spans -} - -# ============================================================================= -if $starship_installed { - $env.STARSHIP_SHELL = "nu" - $env.STARSHIP_SESSION_KEY = (random chars -l 16) - $env.STARSHIP_SESSION_KEY = (random chars -l 16) - $env.PROMPT_MULTILINE_INDICATOR = (starship prompt --continuation) - $env.PROMPT_INDICATOR = "" - $env.PROMPT_COMMAND = {|| starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" } - $env.PROMPT_COMMAND_RIGHT = '' -} else {} - -# ============================================================================= -$env.config = { - show_banner: false - - hooks: { - pre_prompt: [{ || - if $direnv_installed { - direnv export json | from json | default {} | load-env - } else { return } - }] - } - - rm: { - always_trash: true - } - - table: { - mode: compact - index_mode: auto - } - - completions: { - quick: true - partial: true - case_sensitive: false - algorithm: "fuzzy" - external: { - enable: true - completer: $external_completer - max_results: 100 - } - } -} - diff --git a/parts/pkgs/extraPackages/nushell/default.nix b/parts/pkgs/extraPackages/nushell/default.nix deleted file mode 100644 index ab8b54b..0000000 --- a/parts/pkgs/extraPackages/nushell/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - inputs, - lib, - pkgs, - ... -}: let - inherit (lib) concatStringsSep mapAttrsToList; - aliases = import ./aliases.nix {inherit pkgs;}; - - aliasesAsString = - concatStringsSep "\n" - (mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases); - - packages = import ./packages.nix {inherit pkgs;}; - - nushell-wrapped = inputs.wrapper-manager.lib.build { - inherit pkgs; - modules = [ - { - wrappers.nushell-wrapped = { - basePackage = pkgs.nushell; - pathAdd = packages; - env.STARSHIP_CONFIG = { - force = true; - value = ./starship.toml; - }; - flags = [ - "--env-config" - ./env.nu - - "--config" - ./config.nu - ]; - }; - } - ]; - }; -in - nushell-wrapped diff --git a/parts/pkgs/extraPackages/nushell/env.nu b/parts/pkgs/extraPackages/nushell/env.nu deleted file mode 100644 index 98416e3..0000000 --- a/parts/pkgs/extraPackages/nushell/env.nu +++ /dev/null @@ -1,49 +0,0 @@ -# Code generated by zoxide. DO NOT EDIT. - -# ============================================================================= -# -# Hook configuration for zoxide. -# - -# Initialize hook to add new entries to the database. -if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) { - $env.__zoxide_hooked = true - $env.config = ($env | default {} config).config - $env.config = ($env.config | default {} hooks) - $env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change)) - $env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD)) - $env.config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir| - zoxide add -- $dir - })) -} - -# ============================================================================= -# -# When using zoxide with --no-cmd, alias these internal functions as desired. -# - -# Jump to a directory using only keywords. -def --env --wrapped __zoxide_z [...rest:string] { - let arg0 = ($rest | append '~').0 - let arg0_is_dir = (try {$arg0 | path expand | path type}) == 'dir' - let path = if (($rest | length) <= 1) and ($arg0 == '-' or $arg0_is_dir) { - $arg0 - } else { - (zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n") - } - cd $path -} - -# Jump to a directory using interactive search. -def --env --wrapped __zoxide_zi [...rest:string] { - cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")' -} - -# ============================================================================= -# -# Commands for zoxide. Disable these using --no-cmd. -# - -alias cd = __zoxide_z -alias ci = __zoxide_zi -# ============================================================================= diff --git a/parts/pkgs/extraPackages/nushell/init_zoxide.nu b/parts/pkgs/extraPackages/nushell/init_zoxide.nu deleted file mode 100644 index f6b9a14..0000000 --- a/parts/pkgs/extraPackages/nushell/init_zoxide.nu +++ /dev/null @@ -1,61 +0,0 @@ -# Code generated by zoxide. DO NOT EDIT. - -# ============================================================================= -# -# Hook configuration for zoxide. -# - -# Initialize hook to add new entries to the database. -if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) { - $env.__zoxide_hooked = true - $env.config = ($env | default {} config).config - $env.config = ($env.config | default {} hooks) - $env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change)) - $env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD)) - $env.config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir| - zoxide add -- $dir - })) -} - -# ============================================================================= -# -# When using zoxide with --no-cmd, alias these internal functions as desired. -# - -# Jump to a directory using only keywords. -def --env --wrapped __zoxide_z [...rest:string] { - let arg0 = ($rest | append '~').0 - let arg0_is_dir = (try {$arg0 | path expand | path type}) == 'dir' - let path = if (($rest | length) <= 1) and ($arg0 == '-' or $arg0_is_dir) { - $arg0 - } else { - (zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n") - } - cd $path -} - -# Jump to a directory using interactive search. -def --env --wrapped __zoxide_zi [...rest:string] { - cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")' -} - -# ============================================================================= -# -# Commands for zoxide. Disable these using --no-cmd. -# - -alias z = __zoxide_z -alias zi = __zoxide_zi - -# ============================================================================= -# -# Add this to your env file (find it by running `$nu.env-path` in Nushell): -# -# zoxide init nushell | save -f ~/.zoxide.nu -# -# Now, add this to the end of your config file (find it by running -# `$nu.config-path` in Nushell): -# -# source ~/.zoxide.nu -# -# Note: zoxide only supports Nushell v0.89.0+. diff --git a/parts/pkgs/extraPackages/nushell/packages.nix b/parts/pkgs/extraPackages/nushell/packages.nix deleted file mode 100644 index 6291cc2..0000000 --- a/parts/pkgs/extraPackages/nushell/packages.nix +++ /dev/null @@ -1,50 +0,0 @@ -{pkgs}: (with pkgs; [ - # better cd - zoxide - #better ls - eza - - # better cat - bat - - # better grep - ripgrep - - # better dig - dogdns - - # simply the best fetch tool out there - microfetch - - fzf - -carapace - difftastic - hexyl - gitui - iputils - gnumake - gping - asciinema - inetutils - scc - starship - onefetch - wget - cpufetch - yt-dlp - tealdeer - glow - hyperfine - imagemagick - ffmpeg-full - catimg - nmap - wget - fd - jq - rsync - figlet - unzip - zip -]) diff --git a/parts/pkgs/extraPackages/nushell/starship.toml b/parts/pkgs/extraPackages/nushell/starship.toml deleted file mode 100644 index b50a6f8..0000000 --- a/parts/pkgs/extraPackages/nushell/starship.toml +++ /dev/null @@ -1,10 +0,0 @@ -[directory] -style = "bold cyan" -read_only = " " -truncate_to_repo = false -#truncation_length = 0 -format = "[󰉋 $path]($style)([$read_only]($read_only_style))" -#repo_root_style = "red" -home_symbol = "~" -#disabled = true -