Compare commits
1 Commits
master
...
shell-inhi
Author | SHA1 | Date | |
---|---|---|---|
4feb5b89e8 |
198
home/shell.nix
198
home/shell.nix
@@ -1,85 +1,125 @@
|
|||||||
{pkgs, ...}: {
|
{
|
||||||
programs.fish = {
|
lib,
|
||||||
enable = true;
|
pkgs,
|
||||||
# initExtra = ''
|
userName,
|
||||||
# export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
...
|
||||||
# '';
|
}: {
|
||||||
|
programs = {
|
||||||
shellAliases = {
|
fish = {
|
||||||
# ls aliases
|
enable = true;
|
||||||
ls = "eza --color";
|
shellAliases = {
|
||||||
la = "eza -l -all --color";
|
# ls aliases
|
||||||
ll = "eza -l --color";
|
ls = "eza --color";
|
||||||
lt = "eza -l --color --git";
|
la = "eza -l -all --color";
|
||||||
|
ll = "eza -l --color";
|
||||||
# lazygit alias
|
lt = "eza -l --color --git";
|
||||||
lg = "lazygit";
|
# lazygit alias
|
||||||
|
lg = "lazygit";
|
||||||
# cat, less, more alias
|
# cat, less, more alias
|
||||||
cat = "bat";
|
cat = "bat";
|
||||||
less = "bat";
|
less = "bat";
|
||||||
more = "bat";
|
more = "bat";
|
||||||
|
# top alias
|
||||||
# top alias
|
top = "btm";
|
||||||
top = "btm";
|
|
||||||
};
|
|
||||||
|
|
||||||
functions = {
|
|
||||||
fish_greeting = {
|
|
||||||
body = ''
|
|
||||||
set memes \
|
|
||||||
"Crazy? I was crazy once. They locked me in a room. A rubber room. A rubber room with rats. And rats make me crazy." \
|
|
||||||
"Daddy, chill!" \
|
|
||||||
"What the hell is even that?!" \
|
|
||||||
"Road work ahead? Yeah, I sure hope it does!" \
|
|
||||||
"Look at all those chickens!" \
|
|
||||||
"I smell like beef" \
|
|
||||||
"Say, Coloardo - I'M A GIRAFFE" \
|
|
||||||
"I didn't get no sleep cause of y'all, y'all not gone get any sleep cause of me!" \
|
|
||||||
"This is the dollar store, how good can it be?" \
|
|
||||||
"That was legitness" \
|
|
||||||
"Deez nuts" \
|
|
||||||
"I wanna be a cowboy baby" \
|
|
||||||
"Can I get a waffle? Can I please get a waffle?" \
|
|
||||||
"I'm lesbian. I thought you were American." \
|
|
||||||
"You gotta give 'em that 'hawk tuah' and spit on that thang!" \
|
|
||||||
"We don't do that here..."
|
|
||||||
|
|
||||||
set choose_meme (random)"%"(count $memes)
|
|
||||||
set choose_meme $memes[(math $choose_meme"+1")]
|
|
||||||
|
|
||||||
printf (set_color F90)"%s\n" $choose_meme
|
|
||||||
'';
|
|
||||||
onEvent = "fish_greeting";
|
|
||||||
};
|
};
|
||||||
|
functions =
|
||||||
|
{
|
||||||
|
fish_greeting = {
|
||||||
|
body = ''
|
||||||
|
set memes \
|
||||||
|
"Crazy? I was crazy once. They locked me in a room. A rubber room. A rubber room with rats. And rats make me crazy." \
|
||||||
|
"Daddy, chill!" \
|
||||||
|
"What the hell is even that?!" \
|
||||||
|
"Road work ahead? Yeah, I sure hope it does!" \
|
||||||
|
"Look at all those chickens!" \
|
||||||
|
"I smell like beef" \
|
||||||
|
"Say, Coloardo - I'M A GIRAFFE" \
|
||||||
|
"I didn't get no sleep cause of y'all, y'all not gone get any sleep cause of me!" \
|
||||||
|
"This is the dollar store, how good can it be?" \
|
||||||
|
"That was legitness" \
|
||||||
|
"Deez nuts" \
|
||||||
|
"I wanna be a cowboy baby" \
|
||||||
|
"Can I get a waffle? Can I please get a waffle?" \
|
||||||
|
"I'm lesbian. I thought you were American." \
|
||||||
|
"You gotta give 'em that 'hawk tuah' and spit on that thang!" \
|
||||||
|
"We don't do that here..." \
|
||||||
|
"What are those?! They are my crocs..." \
|
||||||
|
"It's an avocado... Thanks!" \
|
||||||
|
"I am once again asking for your financial support" \
|
||||||
|
"Is that a weed?" \
|
||||||
|
"No, this is Patrick!" \
|
||||||
|
"Come ride, heroes, ride" \
|
||||||
|
"Away with the tide" \
|
||||||
|
"Concede your mind unto the fiend" \
|
||||||
|
"Darkness come, rend the shield of light" \
|
||||||
|
"The sun is setting, darkness taking over - a date with chaos and you're dressed to the nines" \
|
||||||
|
"Now kneel overdweller, your lord commands, there's no salvation for the sons of man" \
|
||||||
|
"Snap click clank whirr whizz wham boom!" \
|
||||||
|
"Rohs an kyn ala na"
|
||||||
|
|
||||||
|
set choose_meme (random)"%"(count $memes)
|
||||||
|
set choose_meme $memes[(math $choose_meme"+1")]
|
||||||
|
printf (set_color F90)"%s\n" $choose_meme
|
||||||
|
'';
|
||||||
|
# onEvent = "fish_greeting";
|
||||||
|
};
|
||||||
|
} // (lib.mkIf pkgs.stdenv.isLinux {
|
||||||
|
block = {
|
||||||
|
body = ''
|
||||||
|
echo "Starting systemd-inhibit..."
|
||||||
|
set inhibit_pid_file /tmp/fish_inhibit_pid_(whoami)
|
||||||
|
bash -c 'systemd-inhibit --no-ask-password --what=idle --who="'${userName}'" --why="manual invocation" sh & echo $! > '"$inhibit_pid_file"' && disown'
|
||||||
|
if test -f $inhibit_pid_file
|
||||||
|
set -g INHIBIT_PID (cat $inhibit_pid_file)
|
||||||
|
echo "Inhibit process started with PID: $INHIBIT_PID"
|
||||||
|
else
|
||||||
|
echo "Failed to start inhibit process"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
unblock = {
|
||||||
|
body = ''
|
||||||
|
set inhibit_pid_file /tmp/fish_inhibit_pid_(whoami)
|
||||||
|
if test -f $inhibit_pid_file
|
||||||
|
set INHIBIT_PID (cat $inhibit_pid_file)
|
||||||
|
echo "Killing inhibit process: $INHIBIT_PID"
|
||||||
|
kill -SIGTERM $INHIBIT_PID 2>/dev/null; or kill -SIGKILL $INHIBIT_PID 2>/dev/null
|
||||||
|
rm -f $inhibit_pid_file
|
||||||
|
set -e INHIBIT_PID
|
||||||
|
echo "Inhibit process terminated"
|
||||||
|
else
|
||||||
|
echo "No inhibit process file found"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
zsh = {
|
||||||
|
enable = true;
|
||||||
programs.zsh = {
|
initContent = ''
|
||||||
enable = true;
|
if [[ -z "$BASH_EXECUTION_STRING" ]]; then
|
||||||
initContent = ''
|
if [[ -n "$ZSH_VERSION" ]]; then
|
||||||
if [[ -z "$BASH_EXECUTION_STRING" ]]; then
|
LOGIN_OPTION="--login"
|
||||||
if [[ -n "$ZSH_VERSION" ]]; then
|
else
|
||||||
LOGIN_OPTION="--login"
|
LOGIN_OPTION=""
|
||||||
else
|
fi
|
||||||
LOGIN_OPTION=""
|
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
|
||||||
fi
|
fi
|
||||||
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
|
'';
|
||||||
fi
|
};
|
||||||
'';
|
bash = {
|
||||||
};
|
enable = true;
|
||||||
|
initExtra = ''
|
||||||
programs.bash = {
|
if [[ -z "$BASH_EXECUTION_STRING" ]]; then
|
||||||
enable = true;
|
if [[ -n "$ZSH_VERSION" ]]; then
|
||||||
initExtra = ''
|
LOGIN_OPTION="--login"
|
||||||
if [[ -z "$BASH_EXECUTION_STRING" ]]; then
|
else
|
||||||
if [[ -n "$ZSH_VERSION" ]]; then
|
LOGIN_OPTION=""
|
||||||
LOGIN_OPTION="--login"
|
fi
|
||||||
else
|
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
|
||||||
LOGIN_OPTION=""
|
|
||||||
fi
|
fi
|
||||||
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
|
'';
|
||||||
fi
|
};
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user