This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
alias ..="cd .."
|
||||
|
||||
alias ls="ls --color=auto"
|
||||
alias l="ls -1p"
|
||||
alias ll="ls -lhp"
|
||||
alias lt="ls -lhtp"
|
||||
alias la="ls -lhap"
|
||||
alias lta="ls -lhatp"
|
||||
alias ldir="ls -dp" # list directories
|
||||
|
||||
alias grep="grep --color=auto"
|
||||
|
||||
alias rm="rm -I --preserve-root"
|
||||
alias mv="mv -iv"
|
||||
alias cp="cp -iv"
|
||||
alias ln="ln -i"
|
||||
alias mkdir="mkdir -pv"
|
||||
alias chown="chown --preserve-root"
|
||||
alias chmod="chmod --preserve-root"
|
||||
alias chgrp="chgrp --preserve-root"
|
||||
|
||||
alias ip="ip --color"
|
||||
alias ipa="ip -brief address"
|
||||
alias ipl="ip -brief link"
|
||||
alias ipr="ip route"
|
||||
|
||||
alias df="df -kTh"
|
||||
alias fzfpac="pacman -Slq | fzf -m --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S"
|
||||
alias path='echo -e ${PATH//:/\\n}' # Pretty print path variables
|
||||
|
||||
# Programs
|
||||
alias h="history"
|
||||
alias o="xdg-open"
|
||||
alias v="nvim"
|
||||
alias vf="fzf --bind 'enter:become(nvim {})'"
|
||||
alias g='git'
|
||||
alias k="kubectl"
|
||||
alias t='task'
|
||||
alias tsh='tasksh'
|
||||
alias z='zathura --fork'
|
||||
alias f='fzf'
|
||||
alias fm='pcmanfm &>/dev/null &'
|
||||
alias mm='micromamba'
|
||||
|
||||
# Languages
|
||||
alias r5="plt-r5rs --no-prim"
|
||||
alias hs="ghci"
|
||||
alias pl="swipl"
|
||||
alias py="python"
|
||||
alias r="R"
|
||||
|
||||
alias azerty="setxkbmap be"
|
||||
alias qwerty="setxkbmap us"
|
||||
alias cole="setxkbmap us -variant colemak"
|
||||
@@ -1,16 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
reboot-to-windows ()
|
||||
{
|
||||
# Check if grub is installed by checking if the command exists, if it does
|
||||
# not, then assume that the system is using systemd-boot
|
||||
if grub-install --version &>/dev/null; then
|
||||
windows_title=$(grep -i windows /boot/grub/grub.cfg | cut -d "'" -f 2)
|
||||
sudo grub-reboot "$windows_title"
|
||||
echo "Grub set to reboot to Windows"
|
||||
else
|
||||
sudo bootctl set-oneshot windows.conf
|
||||
echo "Systemd set to reboot to Windows"
|
||||
fi
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
source "$HOME/.bash_aliases/dualboot"
|
||||
|
||||
alias lm='ddcutil setvcp 10'
|
||||
alias cuda-available='python -c "import torch; print(\"CUDA enabled:\", torch.cuda.is_available());"'
|
||||
@@ -1,6 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
source "$HOME/.bash_aliases/dualboot"
|
||||
|
||||
alias lm='xbacklight -set'
|
||||
@@ -1,9 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC1090
|
||||
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
|
||||
if [[ -z "${DISPLAY}" ]] && [[ "${XDG_VTNR}" -eq 1 ]]; then
|
||||
exec startx "$HOME/.config/X11/xinitrc" >& ~/.xsession-errors
|
||||
fi
|
||||
@@ -1,76 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC1091,SC1090
|
||||
# If not running interactively, don't do anything
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
# Prompt configuration
|
||||
[ -f "$HOME/.bashrc.d/prompt" ] && . "$HOME/.bashrc.d/prompt"
|
||||
|
||||
# Aliases {{{
|
||||
# Load aliases dynamically
|
||||
[ -f "$HOME/.bash_aliases/all" ] && . "$HOME/.bash_aliases/all"
|
||||
[ -f "$HOME/.bash_aliases/hosts/$HOSTNAME" ] && . "$HOME/.bash_aliases/hosts/$HOSTNAME"
|
||||
[ -f "$HOME/.bash_aliases/private" ] && . "$HOME/.bash_aliases/private"
|
||||
[ -f "$HOME/.bash_aliases/lang-js" ] && . "$HOME/.bash_aliases/lang-js"
|
||||
|
||||
# Completions {{{
|
||||
[ -d "$HOME/.bash_completions" ] && for file in "$HOME/.bash_completions"/*; do
|
||||
[ -f "$file" ] && . "$file"
|
||||
done
|
||||
# }}}
|
||||
|
||||
# Host-specific and private configurations
|
||||
[ -f "$HOME/.bashrc.d/hosts/$HOSTNAME" ] && . "$HOME/.bashrc.d/hosts/$HOSTNAME"
|
||||
[ -f "$HOME/.bashrc.d/private" ] && . "$HOME/.bashrc.d/private"
|
||||
# }}}
|
||||
|
||||
# Prompt {{{
|
||||
[ -f "$HOME/.bashrc.d/prompt" ] && . "$HOME/.bashrc.d/prompt"
|
||||
# }}}
|
||||
|
||||
# X11 {{{
|
||||
export XDG_SESSION_TYPE=X11
|
||||
export XDG_CONFIG_HOME=$HOME/.config
|
||||
export XDG_DATA_HOME=$HOME/.local/share
|
||||
# }}}
|
||||
|
||||
# FZF {{{
|
||||
# Check if fzf is installed
|
||||
if [ -f "/usr/bin/fzf" ]; then
|
||||
if [[ $ID == "raspbian" ]]; then
|
||||
. /usr/share/doc/fzf/examples/completion.bash
|
||||
. /usr/share/doc/fzf/examples/key-bindings.bash
|
||||
elif [[ $ID == "arch" ]]; then
|
||||
. /usr/share/fzf/completion.bash
|
||||
. /usr/share/fzf/key-bindings.bash
|
||||
fi
|
||||
|
||||
_fzf_setup_completion path vim zathura xournalpp nvim mpv
|
||||
else
|
||||
echo "fzf not installed"
|
||||
fi
|
||||
# }}}
|
||||
|
||||
# Jupyter {{{
|
||||
export JUPYTERLAB_DIR=$HOME/.local/share/jupyter/lab
|
||||
# }}}
|
||||
|
||||
# Conda {{{
|
||||
[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && . /opt/miniconda3/etc/profile.d/conda.sh
|
||||
# }}}
|
||||
|
||||
# Codi
|
||||
# Usage: codi [filetype] [filename]
|
||||
codi() {
|
||||
local syntax="${1:-python}"
|
||||
shift
|
||||
nvim -c \
|
||||
"let g:startify_disable_at_vimenter = 1 |\
|
||||
set bt=nofile ls=0 noru nonu nornu |\
|
||||
hi ColorColumn ctermbg=NONE |\
|
||||
hi VertSplit ctermbg=NONE |\
|
||||
hi NonText ctermfg=0 |\
|
||||
Codi $syntax" "$@"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
# Desktop configuration
|
||||
@@ -1,19 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
# >>> mamba initialize >>>
|
||||
# !! Contents within this block are managed by 'mamba init' !!
|
||||
export MAMBA_EXE="/usr/bin/micromamba";
|
||||
export MAMBA_ROOT_PREFIX="/home/h/.local/share/micromamba";
|
||||
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__mamba_setup"
|
||||
else
|
||||
if [ -f "/home/h/.local/share/micromamba/etc/profile.d/micromamba.sh" ]; then
|
||||
. "/home/h/.local/share/micromamba/etc/profile.d/micromamba.sh"
|
||||
else
|
||||
export PATH="/home/h/.local/share/micromamba/bin:$PATH" # extra space after export prevents interference from conda init
|
||||
fi
|
||||
fi
|
||||
unset __mamba_setup
|
||||
# <<< mamba initialize <<<
|
||||
@@ -1,22 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
get_branch_name() {
|
||||
git symbolic-ref --quiet --short HEAD 2>/dev/null \
|
||||
|| git rev-parse --short HEAD 2>/dev/null \
|
||||
|| echo 'some branch'
|
||||
}
|
||||
get_git_info() {
|
||||
git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
echo -e "($(get_branch_name))"
|
||||
}
|
||||
|
||||
if [[ $SSH_CONNECTION ]]; then
|
||||
PS1='\[\033[01;31m\]\u@\h\[\033[00m\] $(get_git_info)\W❭\[$(tput sgr0)\] '
|
||||
else
|
||||
PS1='\u $(get_git_info)\W❭\[$(tput sgr0)\] '
|
||||
fi
|
||||
|
||||
# Ellipsis when deep in directory
|
||||
export PROMPT_DIRTRIM=2
|
||||
export PS1
|
||||
@@ -1,33 +0,0 @@
|
||||
$include /etc/inputrc
|
||||
|
||||
set editing-mode vi
|
||||
set keymap vi
|
||||
set show-mode-in-prompt on
|
||||
set vi-ins-mode-string "\1\e[1;32m\2■ \1\e[0m\2"
|
||||
set vi-cmd-mode-string "\1\e[1;31m\2■ \1\e[0m\2"
|
||||
|
||||
set show-all-if-ambiguous on
|
||||
set show-all-if-unmodified off
|
||||
set completion-ignore-case on
|
||||
set completion-map-case on
|
||||
set completion-display-width 0
|
||||
set page-completions off
|
||||
set completion-query-items 128
|
||||
set visible-stats on
|
||||
set skip-completed-text on
|
||||
set mark-symlinked-directories on
|
||||
set colored-completion-prefix on
|
||||
|
||||
$if mode=vi
|
||||
set keyseq-timeout 200
|
||||
set keymap vi-command
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
j: history-search-forward
|
||||
k: history-search-backward
|
||||
set keymap vi-insert
|
||||
"jj": vi-movement-mode
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
"\C-l": clear-screen
|
||||
$endif
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
options.fzf.enable = lib.mkEnableOption "fzf";
|
||||
|
||||
config = lib.mkIf config.fzf.enable {
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableBashIntegration = lib.mkDefault true;
|
||||
defaultCommand = "rg --files";
|
||||
defaultOptions = [
|
||||
"--pointer='❭'"
|
||||
"--height 10%"
|
||||
];
|
||||
fileWidget = {
|
||||
command = "rg --files";
|
||||
options = [ "--preview 'bat {} | head -500'" ];
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
ripgrep
|
||||
bat
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
{
|
||||
options.readline.enable = lib.mkEnableOption "readline";
|
||||
|
||||
config = lib.mkIf config.readline.enable {
|
||||
programs.readline = {
|
||||
enable = true;
|
||||
includeSystemConfig = true;
|
||||
variables = {
|
||||
editing-mode = "vi";
|
||||
keymap = "vi";
|
||||
show-mode-in-prompt = true;
|
||||
vi-ins-mode-string = ''"\1\e[1;32m\2■ \1\e[0m\2"'';
|
||||
vi-cmd-mode-string = ''"\1\e[1;31m\2■ \1\e[0m\2"'';
|
||||
|
||||
show-all-if-ambiguous = true;
|
||||
show-all-if-unmodified = false;
|
||||
completion-ignore-case = true;
|
||||
completion-map-case = true;
|
||||
completion-display-width = 0;
|
||||
page-completions = false;
|
||||
completion-query-items = 128;
|
||||
visible-stats = true;
|
||||
skip-completed-text = true;
|
||||
mark-symlinked-directories = true;
|
||||
colored-completion-prefix = true;
|
||||
};
|
||||
extraConfig = ''
|
||||
$if mode=vi
|
||||
set keyseq-timeout 200
|
||||
set keymap vi-command
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
j: history-search-forward
|
||||
k: history-search-backward
|
||||
set keymap vi-insert
|
||||
"jj": vi-movement-mode
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
"\C-l": clear-screen
|
||||
$endif
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
".." = "cd ..";
|
||||
|
||||
ls = "ls --color=auto";
|
||||
l = "ls -1p";
|
||||
ll = "ls -lhp";
|
||||
lt = "ls -lhtp";
|
||||
la = "ls -lhap";
|
||||
lta = "ls -lhatp";
|
||||
ldir = "ls -dp"; # list directories
|
||||
grep = "grep --color=auto";
|
||||
|
||||
rm = "rm -I --preserve-root";
|
||||
mv = "mv -iv";
|
||||
cp = "cp -iv";
|
||||
ln = "ln -i";
|
||||
mkdir = "mkdir -pv";
|
||||
chown = "chown --preserve-root";
|
||||
chmod = "chmod --preserve-root";
|
||||
chgrp = "chgrp --preserve-root";
|
||||
|
||||
ip = "ip --color";
|
||||
ipa = "ip -brief address";
|
||||
ipl = "ip -brief link";
|
||||
ipr = "ip route";
|
||||
df = "df -kTh";
|
||||
fzfpac = "pacman -Slq | fzf -m --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S";
|
||||
path = ''echo -e ''${PATH//:/\\n}''; # Pretty print path variables
|
||||
|
||||
# Programs
|
||||
h = "history";
|
||||
o = "xdg-open";
|
||||
v = "nvim";
|
||||
vf = "fzf --bind 'enter:become(nvim {})'";
|
||||
g = "git";
|
||||
k = "kubectl";
|
||||
t = "task";
|
||||
tsh = "tasksh";
|
||||
z = "zathura --fork";
|
||||
f = "fzf";
|
||||
fm = "pcmanfm &>/dev/null &";
|
||||
mm = "micromamba";
|
||||
|
||||
# Languages
|
||||
r5 = "plt-r5rs --no-prim";
|
||||
hs = "ghci";
|
||||
pl = "swipl";
|
||||
py = "python";
|
||||
r = "R";
|
||||
|
||||
azerty = "setxkbmap be";
|
||||
qwerty = "setxkbmap us";
|
||||
cole = "setxkbmap us -variant colemak";
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
alias js="node"
|
||||
alias ts="ts-node"
|
||||
|
||||
yarn() {
|
||||
if [[ -f "package-lock.json" ]]; then
|
||||
@@ -37,7 +37,12 @@ in
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
|
||||
shellAliases =
|
||||
lib.optionalAttrs cfg.aliases.all (import ./bash-aliases.nix)
|
||||
// lib.optionalAttrs cfg.aliases.lang-js {
|
||||
js = "node";
|
||||
ts = "ts-node";
|
||||
};
|
||||
historySize = 999999;
|
||||
historyFileSize = -1; # unlimited
|
||||
historyControl = [
|
||||
@@ -52,29 +57,15 @@ in
|
||||
"ls"
|
||||
"cd"
|
||||
];
|
||||
|
||||
initExtra = ''
|
||||
for f in ${homeDirectory}/.bashrc.d/*; do
|
||||
[ -f "$f" ] && source "$f"
|
||||
done
|
||||
|
||||
${lib.optionalString cfg.aliases.all "source ${homeDirectory}/.bash_aliases/all"}
|
||||
${lib.optionalString cfg.aliases.lang-js "source ${homeDirectory}/.bash_aliases/lang-js"}
|
||||
|
||||
${lib.optionalString cfg.aliases.lang-js (builtins.readFile ./bash-js.bash)}
|
||||
${cfg.extraInit}
|
||||
'';
|
||||
};
|
||||
|
||||
home.file = {
|
||||
".inputrc".source = dotsPath + "/.inputrc";
|
||||
".bashrc.d/prompt".source = dotsPath + "/.bashrc.d/prompt";
|
||||
}
|
||||
// lib.optionalAttrs cfg.aliases.all {
|
||||
".bash_aliases/all".source = dotsPath + "/.bash_aliases/all";
|
||||
}
|
||||
// lib.optionalAttrs cfg.aliases.lang-js {
|
||||
".bash_aliases/lang-js".source = dotsPath + "/.bash_aliases/lang-js";
|
||||
};
|
||||
home.sessionPath = lib.optional cfg.addBinToPath "${dotsPath}/.bin";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,13 +7,23 @@
|
||||
{
|
||||
imports = [
|
||||
./bash.nix
|
||||
./utils.nix
|
||||
./prompt.nix
|
||||
./utils.nix
|
||||
];
|
||||
|
||||
options.shell.enable = lib.mkEnableOption "shell";
|
||||
options = {
|
||||
shell.enable = lib.mkEnableOption "shell";
|
||||
prompt.enable = lib.mkEnableOption "shell prompt" // {
|
||||
default = config.shell.enable;
|
||||
};
|
||||
utils.enable = lib.mkEnableOption "shell utilities" // {
|
||||
default = config.shell.enable;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.shell.enable {
|
||||
fzf.enable = lib.mkDefault true;
|
||||
readline.enable = lib.mkDefault true;
|
||||
tmux.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
}:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.shell.enable {
|
||||
config = lib.mkIf config.prompt.enable {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
||||
@@ -1,26 +1,12 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.shell.enable {
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableBashIntegration = lib.mkDefault true;
|
||||
defaultCommand = "rg --files";
|
||||
defaultOptions = [
|
||||
"--pointer='❭'"
|
||||
"--height 10%"
|
||||
];
|
||||
fileWidget = {
|
||||
command = "rg --files";
|
||||
options = [ "--preview 'bat {} | head -500'" ];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.utils.enable {
|
||||
home.packages = with pkgs; [
|
||||
ripgrep
|
||||
bat
|
||||
|
||||
@@ -6,13 +6,10 @@
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.tmux;
|
||||
in
|
||||
{
|
||||
options.tmux.enable = lib.mkEnableOption "tmux";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = lib.mkIf config.tmux.enable {
|
||||
home.packages = with pkgs; [
|
||||
tmuxp
|
||||
reptyr
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
cfg = config.audio;
|
||||
in
|
||||
{
|
||||
imports = [ ./audio-automation.nix ];
|
||||
|
||||
options.audio.enable = lib.mkEnableOption "audio";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = lib.mkIf config.audio.enable {
|
||||
nixpkgs.allowedUnfree = [
|
||||
"spotify"
|
||||
"spotify-unwrapped"
|
||||
|
||||
Reference in New Issue
Block a user