Nix shell uses zsh now, refactored shell-aliases.nix
This commit is contained in:
parent
b145eba49c
commit
1eb661726b
2 changed files with 70 additions and 14 deletions
|
|
@ -5,15 +5,61 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
aliases = [
|
||||||
|
{
|
||||||
|
name = "nixrebt";
|
||||||
|
cmd = "sudo nixos-rebuild switch --flake /home/jack/nixos/#t480";
|
||||||
|
desc = "Rebuild NixOS config for t480";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "nixrebd";
|
||||||
|
cmd = "sudo nixos-rebuild switch --flake /home/jack/nixos/#desktop";
|
||||||
|
desc = "Rebuild NixOS config for desktop";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "nixrebs";
|
||||||
|
cmd = "sudo nixos-rebuild switch --flake /home/jack/nixos/#dellserv";
|
||||||
|
desc = "Rebuild NixOS config for dellserv";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "nd";
|
||||||
|
cmd = "nix develop -c zsh";
|
||||||
|
desc = "Enter nix dev shell with zsh";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "v";
|
||||||
|
cmd = "nvim";
|
||||||
|
desc = "Neovim";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "c";
|
||||||
|
cmd = "clear";
|
||||||
|
desc = "Clear terminal";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "cl";
|
||||||
|
cmd = "clear && ls";
|
||||||
|
desc = "Clear and list files";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "nixconf";
|
||||||
|
cmd = "nvim ~/nixos/";
|
||||||
|
desc = "Open nixos config in nvim";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
helpText = lib.concatMapStringsSep "\\n" (a: " ${a.name} -> ${a.desc}") aliases;
|
||||||
|
|
||||||
|
aliasAttrs = lib.listToAttrs (
|
||||||
|
map (a: {
|
||||||
|
name = a.name;
|
||||||
|
value = a.cmd;
|
||||||
|
}) aliases
|
||||||
|
);
|
||||||
|
in
|
||||||
{
|
{
|
||||||
home.shellAliases = {
|
home.shellAliases = aliasAttrs // {
|
||||||
nixrebt = "sudo nixos-rebuild switch --flake /home/jack/nixos/#t480";
|
a = ''echo -e "${helpText}\n a -> List aliases"'';
|
||||||
nixrebd = "sudo nixos-rebuild switch --flake /home/jack/nixos/#desktop";
|
|
||||||
nixrebs = "sudo nixos-rebuild switch --flake /home/jack/nixos/#dellserv";
|
|
||||||
v = "nvim";
|
|
||||||
c = "clear";
|
|
||||||
cl = "clear && ls";
|
|
||||||
nixconf = "nvim ~/nixos/";
|
|
||||||
a = ''echo -e " a -> List aliases\n nixreb[t,d] -> Rebuild nixos config [t for #t480, d for #dektop]\n nixconf -> Open nixos config\n v -> nvim\n c -> clear\n cl -> clear && ls"'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,16 @@
|
||||||
initContent = ''
|
initContent = ''
|
||||||
ZSH_AUTOSUGGEST_USE_ASYNC=false
|
ZSH_AUTOSUGGEST_USE_ASYNC=false
|
||||||
fastfetch -c examples/11
|
fastfetch -c examples/11
|
||||||
|
if [[ -n "$IN_NIX_SHELL" ]]; then
|
||||||
|
PROMPT="%F{blue}[nix-shell]%f $PROMPT"
|
||||||
|
fi
|
||||||
|
nix() {
|
||||||
|
if [[ "$1" == "develop" ]]; then
|
||||||
|
command nix develop -c zsh "''${@:2}"
|
||||||
|
else
|
||||||
|
command nix "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
oh-my-zsh = {
|
oh-my-zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue