Modules/Fish: Update for nix-darwin
This commit is contained in:
@ -210,6 +210,7 @@
|
||||
mylib = darwinMylib;
|
||||
hostname = "darwinix";
|
||||
username = "christoph";
|
||||
headless = false;
|
||||
extraModules = [];
|
||||
};
|
||||
};
|
||||
|
||||
@ -42,8 +42,9 @@ in {
|
||||
fish_pager_color_description ${color.hex.overlay0}
|
||||
'';
|
||||
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
programs.fish = lib.mkMerge [
|
||||
# Linux exclusive config
|
||||
(lib.mkIf pkgs.stdenv.isLinux {
|
||||
generateCompletions = nixosConfig.programs.fish.generateCompletions;
|
||||
|
||||
functions = lib.mergeAttrsList [
|
||||
@ -87,13 +88,6 @@ in {
|
||||
})
|
||||
];
|
||||
|
||||
plugins = [];
|
||||
|
||||
shellInit = ''
|
||||
set fish_greeting
|
||||
yes | fish_config theme save "system-theme"
|
||||
'';
|
||||
|
||||
shellAbbrs = let
|
||||
# Only add " | bat" if bat is installed
|
||||
batify = command: command + (lib.optionalString config.programs.bat.enable " | bat");
|
||||
@ -111,10 +105,6 @@ in {
|
||||
lib.mkMerge [
|
||||
# Abbrs that are always available are defined here.
|
||||
{
|
||||
# Shell basics
|
||||
c = "clear";
|
||||
q = "exit";
|
||||
|
||||
# Fish
|
||||
h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish
|
||||
abbrs = batifyWithArgs "abbr" "-l fish";
|
||||
@ -123,10 +113,8 @@ in {
|
||||
cd = "z"; # zoxide for quickjump to previously visited locations
|
||||
cdd = "zi";
|
||||
b = "z -"; # jump to previous dir
|
||||
mkdir = "mkdir -p"; # also create parents (-p)
|
||||
blk = batify "lsblk -o NAME,LABEL,PARTLABEL,FSTYPE,SIZE,FSUSE%,MOUNTPOINT";
|
||||
blkids = batify "lsblk -o NAME,LABEL,FSTYPE,SIZE,PARTLABEL,MODEL,ID,UUID";
|
||||
watch = "watch -d -c -n 0.5";
|
||||
nps = "nps -e";
|
||||
nd = "nix develop";
|
||||
nb = "nix build -L";
|
||||
@ -134,6 +122,46 @@ in {
|
||||
nr = "nix run";
|
||||
|
||||
ghidra = "_JAVA_AWT_WM_NONREPARENTING=1 ghidra"; # env var for wayland
|
||||
}
|
||||
|
||||
(abbrify pkgs.nix-search-tv {search = "nix-search-tv print --indexes 'nixos,home-manager,nixpkgs,nur' | fzf --preview 'nix-search-tv preview {}' --scheme history";})
|
||||
|
||||
# Doesn't work with abbrify because I have nnn.override...
|
||||
(lib.optionalAttrs config.homemodules.nnn.enable {n = "nnncd -a";})
|
||||
(lib.optionalAttrs config.homemodules.nnn.enable {np = "nnncd -a -P p";})
|
||||
|
||||
(abbrify pkgs.ranger {r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR";})
|
||||
|
||||
(lib.optionalAttrs config.homemodules.rmpc.enable {r = "rcmp";})
|
||||
|
||||
(abbrify pkgs.rsync rec {
|
||||
rsync = "rsync -ahv --inplace --partial --info=progress2";
|
||||
copy = rsync;
|
||||
})
|
||||
|
||||
# (abbrify pkgs.sd {sed = "sd";})
|
||||
];
|
||||
})
|
||||
|
||||
# Common config
|
||||
{
|
||||
enable = true;
|
||||
|
||||
shellAbbrs = let
|
||||
# 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
|
||||
c = "clear";
|
||||
q = "exit";
|
||||
mkdir = "mkdir -p"; # also create parents (-p)
|
||||
watch = "watch -d -c -n 0.5";
|
||||
sy = "sudo -u ${username} yazi";
|
||||
}
|
||||
|
||||
@ -144,6 +172,11 @@ in {
|
||||
alldisks = "duf";
|
||||
})
|
||||
|
||||
(abbrify pkgs.ripgrep {
|
||||
rg = "rg --trim --pretty";
|
||||
# grep = rg;
|
||||
})
|
||||
|
||||
(abbrify pkgs.eza {
|
||||
ls = "eza --color=always --group-directories-first -F --git --icons=always --octal-permissions";
|
||||
lsl = "eza --color=always --group-directories-first -F --git --icons=always --octal-permissions -l";
|
||||
@ -174,30 +207,16 @@ in {
|
||||
(lib.optionalAttrs config.homemodules.kitty.enable {ssh = "kitty +kitten ssh";})
|
||||
|
||||
(abbrify pkgs.lazygit {lg = "lazygit";})
|
||||
|
||||
(abbrify pkgs.nix-search-tv {search = "nix-search-tv print --indexes 'nixos,home-manager,nixpkgs,nur' | fzf --preview 'nix-search-tv preview {}' --scheme history";})
|
||||
|
||||
# Doesn't work with abbrify because I have nnn.override...
|
||||
(lib.optionalAttrs config.homemodules.nnn.enable {n = "nnncd -a";})
|
||||
(lib.optionalAttrs config.homemodules.nnn.enable {np = "nnncd -a -P p";})
|
||||
|
||||
(abbrify pkgs.ranger {r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR";})
|
||||
|
||||
(abbrify pkgs.ripgrep rec {
|
||||
rg = "rg --trim --pretty";
|
||||
# grep = rg;
|
||||
})
|
||||
|
||||
(lib.optionalAttrs config.homemodules.rmpc.enable {r = "rcmp";})
|
||||
|
||||
(abbrify pkgs.rsync rec {
|
||||
rsync = "rsync -ahv --inplace --partial --info=progress2";
|
||||
copy = rsync;
|
||||
})
|
||||
|
||||
# (abbrify pkgs.sd {sed = "sd";})
|
||||
];
|
||||
};
|
||||
|
||||
plugins = [];
|
||||
|
||||
shellInit = ''
|
||||
set fish_greeting
|
||||
yes | fish_config theme save "system-theme"
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
|
||||
@ -87,13 +87,14 @@
|
||||
username,
|
||||
publicKeys,
|
||||
extraModules ? [],
|
||||
headless ? false,
|
||||
}:
|
||||
inputs.nix-darwin.lib.darwinSystem {
|
||||
inherit system;
|
||||
|
||||
# Values in "specialArgs" are propagated to all system modules.
|
||||
specialArgs = {
|
||||
inherit inputs system hostname mylib username publicKeys;
|
||||
inherit inputs system hostname mylib username publicKeys headless;
|
||||
};
|
||||
|
||||
modules = builtins.concatLists [
|
||||
@ -121,7 +122,7 @@
|
||||
home-manager = {
|
||||
# Values in "extraSpecialArgs" are propagated to all HM modules.
|
||||
extraSpecialArgs = {
|
||||
inherit inputs system hostname mylib username publicKeys;
|
||||
inherit inputs system hostname mylib username publicKeys headless;
|
||||
};
|
||||
|
||||
# Use the "pkgs" from the system configuration.
|
||||
|
||||
Reference in New Issue
Block a user