Modules/Fish: Update abbrs for nix-darwin
This commit is contained in:
@ -42,7 +42,21 @@ in {
|
|||||||
fish_pager_color_description ${color.hex.overlay0}
|
fish_pager_color_description ${color.hex.overlay0}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.fish = lib.mkMerge [
|
programs.fish = let
|
||||||
|
# Only add " | bat" if bat is installed
|
||||||
|
batify = command: command + (lib.optionalString config.programs.bat.enable " | bat");
|
||||||
|
|
||||||
|
# Same as above but with args for bat
|
||||||
|
batifyWithArgs = command: args: command + (lib.optionalString config.programs.bat.enable (" | bat " + args));
|
||||||
|
|
||||||
|
# These can be used for my config.homemodules and for HM config.programs,
|
||||||
|
# as both of these add the package to home.packages
|
||||||
|
hasHomePackage = package: (mylib.modules.contains config.home.packages package);
|
||||||
|
|
||||||
|
# Only add fish abbr if package is installed
|
||||||
|
abbrify = package: abbr: (lib.optionalAttrs (hasHomePackage package) abbr);
|
||||||
|
in
|
||||||
|
lib.mkMerge [
|
||||||
# Darwin exclusive config
|
# Darwin exclusive config
|
||||||
(lib.mkIf pkgs.stdenv.isDarwin {
|
(lib.mkIf pkgs.stdenv.isDarwin {
|
||||||
shellInit = ''
|
shellInit = ''
|
||||||
@ -57,15 +71,7 @@ in {
|
|||||||
if not contains "/opt/homebrew/share/info" $INFOPATH; set --global --export INFOPATH "/opt/homebrew/share/info" $INFOPATH; end;
|
if not contains "/opt/homebrew/share/info" $INFOPATH; set --global --export INFOPATH "/opt/homebrew/share/info" $INFOPATH; end;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
shellAbbrs = let
|
shellAbbrs = lib.mkMerge [
|
||||||
# These can be used for my config.homemodules and for HM config.programs,
|
|
||||||
# as both of these add the package to home.packages
|
|
||||||
hasHomePackage = package: (mylib.modules.contains config.home.packages package);
|
|
||||||
|
|
||||||
# Only add fish abbr if package is installed
|
|
||||||
abbrify = package: abbr: (lib.optionalAttrs (hasHomePackage package) abbr);
|
|
||||||
in
|
|
||||||
lib.mkMerge [
|
|
||||||
{
|
{
|
||||||
rebuild = "sudo darwin-rebuild switch --flake .#darwinix";
|
rebuild = "sudo darwin-rebuild switch --flake .#darwinix";
|
||||||
}
|
}
|
||||||
@ -124,34 +130,12 @@ in {
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
shellAbbrs = let
|
shellAbbrs = lib.mkMerge [
|
||||||
# Only add " | bat" if bat is installed
|
|
||||||
batify = command: command + (lib.optionalString config.programs.bat.enable " | bat");
|
|
||||||
|
|
||||||
# Same as above but with args for bat
|
|
||||||
batifyWithArgs = command: args: command + (lib.optionalString config.programs.bat.enable (" | bat " + args));
|
|
||||||
|
|
||||||
# These can be used for my config.homemodules and for HM config.programs,
|
|
||||||
# as both of these add the package to home.packages
|
|
||||||
hasHomePackage = package: (mylib.modules.contains config.home.packages package);
|
|
||||||
|
|
||||||
# Only add fish abbr if package is installed
|
|
||||||
abbrify = package: abbr: (lib.optionalAttrs (hasHomePackage package) abbr);
|
|
||||||
in
|
|
||||||
lib.mkMerge [
|
|
||||||
# Abbrs that are always available are defined here.
|
# Abbrs that are always available are defined here.
|
||||||
{
|
{
|
||||||
# Fish
|
|
||||||
h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish
|
|
||||||
abbrs = batifyWithArgs "abbr" "-l fish";
|
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
blk = batify "lsblk -o NAME,LABEL,PARTLABEL,FSTYPE,SIZE,FSUSE%,MOUNTPOINT";
|
blk = batify "lsblk -o NAME,LABEL,PARTLABEL,FSTYPE,SIZE,FSUSE%,MOUNTPOINT";
|
||||||
blkids = batify "lsblk -o NAME,LABEL,FSTYPE,SIZE,PARTLABEL,MODEL,ID,UUID";
|
blkids = batify "lsblk -o NAME,LABEL,FSTYPE,SIZE,PARTLABEL,MODEL,ID,UUID";
|
||||||
nd = "nix develop";
|
|
||||||
nb = "nix build -L";
|
|
||||||
ns = "nix shell nixpkgs#";
|
|
||||||
nr = "nix run";
|
|
||||||
|
|
||||||
ghidra = "_JAVA_AWT_WM_NONREPARENTING=1 ghidra"; # env var for wayland
|
ghidra = "_JAVA_AWT_WM_NONREPARENTING=1 ghidra"; # env var for wayland
|
||||||
}
|
}
|
||||||
@ -174,17 +158,9 @@ in {
|
|||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
shellAbbrs = let
|
shellAbbrs = lib.mkMerge [
|
||||||
# These can be used for my config.homemodules and for HM config.programs,
|
|
||||||
# as both of these add the package to home.packages
|
|
||||||
hasHomePackage = package: (mylib.modules.contains config.home.packages package);
|
|
||||||
|
|
||||||
# Only add fish abbr if package is installed
|
|
||||||
abbrify = package: abbr: (lib.optionalAttrs (hasHomePackage package) abbr);
|
|
||||||
in
|
|
||||||
lib.mkMerge [
|
|
||||||
{
|
{
|
||||||
# Shell basics
|
# Shell
|
||||||
c = "clear";
|
c = "clear";
|
||||||
q = "exit";
|
q = "exit";
|
||||||
mkdir = "mkdir -p"; # also create parents (-p)
|
mkdir = "mkdir -p"; # also create parents (-p)
|
||||||
@ -193,6 +169,16 @@ in {
|
|||||||
cd = "z"; # zoxide for quickjump to previously visited locations
|
cd = "z"; # zoxide for quickjump to previously visited locations
|
||||||
cdd = "zi";
|
cdd = "zi";
|
||||||
b = "z -"; # jump to previous dir
|
b = "z -"; # jump to previous dir
|
||||||
|
|
||||||
|
# Fish
|
||||||
|
h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish
|
||||||
|
abbrs = batifyWithArgs "abbr" "-l fish";
|
||||||
|
|
||||||
|
# Nix
|
||||||
|
nd = "nix develop";
|
||||||
|
nb = "nix build -L";
|
||||||
|
ns = "nix shell nixpkgs#";
|
||||||
|
nr = "nix run";
|
||||||
nps = "nps -e";
|
nps = "nps -e";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user