From fb5f31a5c1b913f0e739b2608a8e6c290c16ecc6 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 11 Nov 2024 16:25:17 +0900 Subject: [PATCH] Prefer built-in shell alias rather than shims (#927) Enable zsh completion. Resolves GH-921 And simplify adding task, current workflow is annoy Except when the CLI adding parameters as `la` and `lat` --- flake.nix | 1 - home-manager/common.nix | 9 +++++++++ home-manager/packages.nix | 1 - nixos/desktop/default.nix | 2 -- pkgs/README.md | 2 +- pkgs/default.nix | 6 +----- pkgs/g/default.nix | 8 -------- pkgs/zed/default.nix | 7 ------- pkgs/zed/zed.bash | 1 - 9 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 pkgs/g/default.nix delete mode 100644 pkgs/zed/default.nix delete mode 100644 pkgs/zed/zed.bash diff --git a/flake.nix b/flake.nix index 35acef1c..d1c05af8 100644 --- a/flake.nix +++ b/flake.nix @@ -144,7 +144,6 @@ "todo" "la" "lat" - "zed" "ghqf" "git-delete-merged-branches" "git-log-fzf" diff --git a/home-manager/common.nix b/home-manager/common.nix index aaddc510..a9eec8b4 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -84,6 +84,15 @@ # systemd config overrides this value in gnome-shell, however this will be used in Linux VT console time = "en_DK.UTF-8"; # To prefer ISO 8601 format. See https://unix.stackexchange.com/questions/62316/why-is-there-no-euro-english-locale }; + + # Prefer this rather than adding wrapped script to make zsh possible to complete + # Take care if I you adding nushell in the Unix dependencies again + shellAliases = { + "g" = "git"; + + # https://github.com/NixOS/nixpkgs/pull/344193 + "zed" = "zed-editor"; + }; }; # Let Home Manager install and manage itself. diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 82d35646..4ff262bf 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -115,7 +115,6 @@ todo ghqf p - g walk envs ir diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index e384e093..79509cab 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -118,8 +118,6 @@ # version in nixos-24.05 does not enable IME # Don't use `buildFHSEnv` even through want to apply LSP smart. See GH-809 edge-pkgs.zed-editor - # Adding for zed instead of zeditor since https://github.com/NixOS/nixpkgs/pull/344193. Also keep original zed-editor package here to add icons for GUI - homemade-pkgs.zed edge-pkgs.podman-desktop diff --git a/pkgs/README.md b/pkgs/README.md index 00bb8952..c4f66875 100644 --- a/pkgs/README.md +++ b/pkgs/README.md @@ -2,7 +2,7 @@ - Tiny tools by me, they may be rewritten with another language. - Nix packages that are not yet included in [NixOS/nixpkgs](https://github.com/NixOS/nixpkgs) -- Aliases across multiple shells +- Aliases across multiple shells if it unfits for native shell alias ## Do not diff --git a/pkgs/default.nix b/pkgs/default.nix index b8db53f3..93e25401 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,7 +1,7 @@ { pkgs, edge-pkgs, ... }: { - bump_completions = import ./bump_completions { inherit pkgs edge-pkgs; }; + bump_completions = import ./bump_completions { inherit pkgs; }; bump_gomod = import ./bump_gomod { inherit pkgs; }; @@ -18,16 +18,12 @@ lat = import ./lat { inherit pkgs; }; - zed = import ./zed { inherit pkgs edge-pkgs; }; - walk = import ./walk { inherit pkgs; }; ir = pkgs.callPackage ./ir { }; p = import ./p { inherit pkgs; }; - g = import ./g { inherit pkgs; }; - git-delete-merged-branches = import ./git-delete-merged-branches { inherit pkgs; }; fzf-bind-posix-shell-history-to-git-commit-message = diff --git a/pkgs/g/default.nix b/pkgs/g/default.nix deleted file mode 100644 index 2360944d..00000000 --- a/pkgs/g/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: -pkgs.writeShellApplication { - name = "g"; - runtimeInputs = with pkgs; [ git ]; - text = '' - git "$@" - ''; -} diff --git a/pkgs/zed/default.nix b/pkgs/zed/default.nix deleted file mode 100644 index 9f2b4ade..00000000 --- a/pkgs/zed/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, edge-pkgs, ... }: -pkgs.writeShellApplication rec { - name = "zed"; # This will be the alias. So do not specify `zed-editor` - text = builtins.readFile ./${name}.bash; - runtimeInputs = [ edge-pkgs.zed-editor ]; - meta.description = "Make shorter command again even through applied https://github.com/NixOS/nixpkgs/pull/344193"; -} diff --git a/pkgs/zed/zed.bash b/pkgs/zed/zed.bash deleted file mode 100644 index f42bc11c..00000000 --- a/pkgs/zed/zed.bash +++ /dev/null @@ -1 +0,0 @@ -zeditor "$@"