nix #11
|
@ -1,2 +0,0 @@
|
||||||
clear
|
|
||||||
reset
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
source ~/.config/shell/shenv
|
|
||||||
source ~/.config/shell/commonenv
|
|
||||||
source ~/.config/shell/shrc
|
|
||||||
source ~/.config/shell/commonrc
|
|
||||||
source ~/.config/shell/bashrc
|
|
5
bashrc
5
bashrc
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
source ~/.config/shell/shrc
|
|
||||||
source ~/.config/shell/commonrc
|
|
||||||
source ~/.config/shell/bashrc
|
|
|
@ -63,16 +63,80 @@ in
|
||||||
# Fzf
|
# Fzf
|
||||||
FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}";
|
FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}";
|
||||||
};
|
};
|
||||||
|
treatsHomeAsJunk = [
|
||||||
|
# Programs that think $HOME is a reasonable place to put their junk
|
||||||
|
# and don't allow the user to change those questionable choices
|
||||||
|
"adb"
|
||||||
|
"audacity"
|
||||||
|
"binwalk" # Should use .config according to the GitHub code though
|
||||||
|
"cabal" # TODO May have options but last time I tried it it crashed
|
||||||
|
"cmake"
|
||||||
|
"ddd"
|
||||||
|
"ghidra"
|
||||||
|
"itch"
|
||||||
|
"simplescreenrecorder" # Easy fix https://github.com/MaartenBaert/ssr/blob/1556ae456e833992fb6d39d40f7c7d7c337a4160/src/Main.cpp#L252
|
||||||
|
"vd"
|
||||||
|
"wpa_cli"
|
||||||
|
# TODO Maybe we can do something about node-gyp
|
||||||
|
];
|
||||||
commonShellAliases = {
|
commonShellAliases = {
|
||||||
|
# Completion for existing commands
|
||||||
|
ls = "ls -h --color=auto";
|
||||||
|
mkdir = "mkdir -v";
|
||||||
|
# cp = "cp -i"; # Disabled because conflicts with the ZSH/Bash one. This separation is confusing I swear.
|
||||||
|
mv = "mv -iv";
|
||||||
|
free = "free -h";
|
||||||
|
df = "df -h";
|
||||||
|
ffmpeg = "ffmpeg -hide_banner";
|
||||||
|
ffprobe = "ffprobe -hide_banner";
|
||||||
|
ffplay = "ffplay -hide_banner";
|
||||||
|
# TODO Add ipython --no-confirm-exit --pdb
|
||||||
|
|
||||||
|
# Frequent mistakes
|
||||||
|
sl = "ls";
|
||||||
|
al = "la";
|
||||||
|
mdkir = "mkdir";
|
||||||
|
systemclt = "systemctl";
|
||||||
|
please = "sudo";
|
||||||
|
|
||||||
|
# Shortcuts for commonly used commands
|
||||||
|
# ll = "ls -l"; # Disabled because would overwrite the colored one
|
||||||
|
# la = "ls -la"; # Eh maybe it's not that bad, but for now let's keep compatibility
|
||||||
|
s = "sudo -s -E";
|
||||||
|
# n = "$HOME/.config/i3/terminal & disown"; # Not used anymore since alacritty daemon mode doesn't preserve environment variables
|
||||||
|
x = "startx ${config.xdg.configHome}/xinitrc; logout";
|
||||||
|
nx = "nvidia-xrun ${config.xdg.configHome}/xinitrc; sudo systemctl start nvidia-xrun-pm; logout";
|
||||||
|
# TODO Put in display.nix
|
||||||
|
# Was also thinking of not storing the config in .config and use nix-store instead,
|
||||||
|
# but maybe it's a bad idea as home-manager switch doesn't replace aliases in running shells
|
||||||
|
# FIXME Is it still relevant with NixOS?
|
||||||
|
|
||||||
|
|
||||||
|
# Give additional config to those programs, and not have them in my path
|
||||||
|
bower = "bower --config.storage.packages=${config.xdg.cacheHome}/bower/packages --config.storage.registry=${config.xdg.cacheHome}/bower/registry --config.storage.links=${config.xdg.cacheHome}/bower/links";
|
||||||
|
gdb = "gdb -x ${config.xdg.configHome}/gdbinit";
|
||||||
|
iftop = "iftop -c ${config.xdg.configHome}/iftoprc";
|
||||||
|
lmms = "lmms --config ${config.xdg.configHome}/lmmsrc.xml";
|
||||||
|
tmux = "tmux -f ${config.xdg.configHome}/tmux/tmux.conf";
|
||||||
|
|
||||||
|
# Preference
|
||||||
|
vi = "nvim";
|
||||||
|
vim = "nvim";
|
||||||
|
wol = "wakeonlan"; # TODO Really, isn't wol better? Also wtf Arch aliases to pass because neither is installed anyways x)
|
||||||
|
mutt = "neomutt";
|
||||||
|
|
||||||
|
# Bash/Zsh only
|
||||||
cp = "cp -i --reflink=auto";
|
cp = "cp -i --reflink=auto";
|
||||||
grep = "grep --color=auto";
|
grep = "grep --color=auto";
|
||||||
dd = "dd status=progress";
|
dd = "dd status=progress";
|
||||||
rm = "rm -v --one-file-system";
|
rm = "rm -v --one-file-system";
|
||||||
free = "free -m";
|
# free = "free -m"; # Disabled because... no? Why?
|
||||||
diff = "diff --color=auto";
|
diff = "diff --color=auto";
|
||||||
dmesg = "dmesg --ctime";
|
dmesg = "dmesg --ctime";
|
||||||
wget = "wget --hsts-file ${config.xdg.cacheHome}/wget-hsts";
|
wget = "wget --hsts-file ${config.xdg.cacheHome}/wget-hsts";
|
||||||
};
|
} // lib.attrsets.mergeAttrsList (map (p: {"${p}" = "HOME=${config.xdg.cacheHome}/junkhome ${p}";}) treatsHomeAsJunk);
|
||||||
|
# TODO Maybe make nixpkg wrapper instead? So it also works from dmenu
|
||||||
|
# Could also accept my fate... Home-manager doesn't necessarily make it easy to put things out of the home directory
|
||||||
historySize = 100000;
|
historySize = 100000;
|
||||||
historyFile = "${config.xdg.cacheHome}/shell_history";
|
historyFile = "${config.xdg.cacheHome}/shell_history";
|
||||||
in
|
in
|
||||||
|
|
|
@ -448,7 +448,7 @@
|
||||||
{ };
|
{ };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
".xinitrc" = {
|
"${config.xdg.configHome}/xinitrc" = {
|
||||||
# TODO Configurable
|
# TODO Configurable
|
||||||
source = pkgs.writeShellScript "xinitrc" ''
|
source = pkgs.writeShellScript "xinitrc" ''
|
||||||
${pkgs.xorg.xrdb}/bin/xrdb ${config.xresources.path}
|
${pkgs.xorg.xrdb}/bin/xrdb ${config.xresources.path}
|
||||||
|
|
3
config/shell/.gitignore
vendored
3
config/shell/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
||||||
extrc
|
|
||||||
*.zwc
|
|
||||||
.zcompdump
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
source ~/.config/shell/shenv
|
|
||||||
source ~/.config/shell/commonenv
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
source ~/.config/shell/shrc
|
|
||||||
source ~/.config/shell/commonrc
|
|
||||||
source ~/.config/shell/zshrc
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Shell common environment variables and functions (BusyBox compatible)
|
|
||||||
#
|
|
||||||
|
|
||||||
# And for the rest, see aliases
|
|
||||||
direnv JUNKHOME "$HOME/.cache/junkhome"
|
|
|
@ -1,104 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Shell common aliases and customizations (BusyBox compatible)
|
|
||||||
#
|
|
||||||
|
|
||||||
## COMMAND CONFIGURATION
|
|
||||||
|
|
||||||
# Completion for existing commands
|
|
||||||
alias ls='ls -h --color=auto'
|
|
||||||
alias mkdir='mkdir -v'
|
|
||||||
alias cp="cp -i"
|
|
||||||
alias mv="mv -iv"
|
|
||||||
alias free='free -h'
|
|
||||||
alias df='df -h'
|
|
||||||
|
|
||||||
alias ffmpeg='ffmpeg -hide_banner'
|
|
||||||
alias ffprobe='ffprobe -hide_banner'
|
|
||||||
alias ffplay='ffplay -hide_banner'
|
|
||||||
|
|
||||||
# ALIASES
|
|
||||||
|
|
||||||
# Frequent mistakes
|
|
||||||
alias sl=ls
|
|
||||||
alias al=la
|
|
||||||
alias mdkir=mkdir
|
|
||||||
alias systemclt=systemctl
|
|
||||||
alias please=sudo
|
|
||||||
|
|
||||||
# Shortcuts for commonly used commands
|
|
||||||
alias ll="ls -l"
|
|
||||||
alias la="ls -la"
|
|
||||||
alias s='sudo -s -E'
|
|
||||||
alias n='$HOME/.config/i3/terminal & disown'
|
|
||||||
alias x='startx $HOME/.config/xinitrc; logout'
|
|
||||||
alias nx='nvidia-xrun $HOME/.config/xinitrc; sudo systemctl start nvidia-xrun-pm; logout'
|
|
||||||
|
|
||||||
# For programs that think $HOME is a reasonable place to put their junk
|
|
||||||
# and don't allow the user to change those questionable choices
|
|
||||||
alias adb='HOME=$JUNKHOME adb'
|
|
||||||
alias audacity='HOME=$JUNKHOME audacity'
|
|
||||||
alias binwalk='HOME=$JUNKHOME binwalk' # Should use .config according to the GitHub code though
|
|
||||||
alias cabal='HOME=$JUNKHOME cabal' # TODO May have options but last time I tried it it crashed
|
|
||||||
alias cmake='HOME=$JUNKHOME cmake'
|
|
||||||
alias ddd='HOME=$JUNKHOME ddd'
|
|
||||||
alias ghidra='HOME=$JUNKHOME ghidra'
|
|
||||||
alias itch='HOME=$JUNKHOME itch'
|
|
||||||
alias simplescreenrecorder='HOME=$JUNKHOME simplescreenrecorder' # Easy fix https://github.com/MaartenBaert/ssr/blob/1556ae456e833992fb6d39d40f7c7d7c337a4160/src/Main.cpp#L252
|
|
||||||
alias vd='HOME=$JUNKHOME vd'
|
|
||||||
alias wpa_cli='HOME=$JUNKHOME wpa_cli'
|
|
||||||
# TODO Maybe we can do something about node-gyp
|
|
||||||
|
|
||||||
alias bower='bower --config.storage.packages=~/.cache/bower/packages --config.storage.registry=~/.cache/bower/registry --config.storage.links=~/.cache/bower/links'
|
|
||||||
alias gdb='gdb -x $HOME/.config/gdbinit'
|
|
||||||
alias iftop='iftop -c $HOME/.config/iftoprc'
|
|
||||||
alias lmms='lmms --config $HOME/.config/lmmsrc.xml'
|
|
||||||
alias tmux='tmux -f $HOME/.config/tmux/tmux.conf'
|
|
||||||
|
|
||||||
# TODO ruby's gem when I find a use for it
|
|
||||||
|
|
||||||
# FUNCTIONS
|
|
||||||
trysource() {
|
|
||||||
if [ -f "$1" ]
|
|
||||||
then
|
|
||||||
. "$1"
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_i_prefer() { # executables...
|
|
||||||
for candidate in "$@"
|
|
||||||
do
|
|
||||||
if [ -x "$(command -v "$candidate")" ]
|
|
||||||
then
|
|
||||||
choice="$candidate"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -z "$choice" ]
|
|
||||||
then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
for candidate in "$@"
|
|
||||||
do
|
|
||||||
if [ "$candidate" != "$choice" ]
|
|
||||||
then
|
|
||||||
alias "$candidate"="$choice"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
_i_prefer nvim vim vi
|
|
||||||
_i_prefer gopass pass
|
|
||||||
_i_prefer wakeonlan wol
|
|
||||||
_i_prefer neomutt mutt
|
|
||||||
unset _i_prefer
|
|
||||||
|
|
||||||
## COLORS
|
|
||||||
|
|
||||||
# trysource ~/.local/bin/colorSchemeApply
|
|
||||||
# Needed because xterm/urxvt won't use the last color, needed for vim
|
|
||||||
|
|
||||||
## EXTENSIONS
|
|
||||||
trysource ~/.config/shell/extrc
|
|
Loading…
Reference in a new issue