Add zsh completions
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{ lib, inputs, ... }:
|
||||
{
|
||||
home-manager.users.${user}.programs.zsh = {
|
||||
shellAliases.nd = "nix-develop";
|
||||
|
||||
initExtra = ''
|
||||
initExtra = let
|
||||
devShells = lib.strings.concatStringsSep " " (lib.attrsets.mapAttrsToList (key: _: key) inputs.self.devShells);
|
||||
in ''
|
||||
nix-develop() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: nix-develop <shell>"
|
||||
@@ -15,6 +17,13 @@
|
||||
fi
|
||||
nix develop self#"$1" -c "$SHELL"
|
||||
}
|
||||
|
||||
_nix-develop-completion() {
|
||||
local shells=(${devShells})
|
||||
compadd -- $shells
|
||||
}
|
||||
|
||||
compdef _nix-develop-completion nix-develop
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user