Initial commit lol

This commit is contained in:
langedev 2023-11-19 19:03:46 -08:00
parent a2318e586a
commit ed3d2e8ef8
18 changed files with 375 additions and 0 deletions

View file

@ -0,0 +1,32 @@
{ config, pkgs, ... }:
{
programs.alacritty.enable = true;
programs.alacritty.settings = {
font = let fam = "Cascadia Code"; in {
normal = {
family = fam;
style = "Regular";
};
bold = {
family = fam;
style = "Bold";
};
italic = {
family = fam;
style = "Italic";
};
bold_italic = {
family = fam;
style = "Bold Italic";
};
offset = {
x = 0;
y = 0;
};
size = 24.0;
};
};
}

43
programs/fish/default.nix Normal file
View file

@ -0,0 +1,43 @@
{ config, pkgs, ... }:
{
programs.fish.enable = true;
programs.fish.interactiveShellInit = ''
cat ~/.cache/wal/sequences
'';
programs.fish.functions = {
fish_greeting = "";
fish_prompt = ''
${builtins.readFile ./functions/fish_prompt.fish}
'';
fish_right_prompt = ''
${builtins.readFile ./functions/fish_right_prompt.fish}
'';
git_branch_name = ''
${builtins.readFile ./functions/git_branch_name.fish}
'';
git_is_dirty = ''
${builtins.readFile ./functions/git_is_dirty.fish}
'';
git_is_repo = ''
${builtins.readFile ./functions/git_is_repo.fish}
'';
git_is_staged = ''
${builtins.readFile ./functions/git_is_staged.fish}
'';
git_is_touched = ''
${builtins.readFile ./functions/git_is_touched.fish}
'';
git_is_worktree = ''
${builtins.readFile ./functions/git_is_worktree.fish}
'';
n = ''
${builtins.readFile ./functions/n.fish}
'';
ssh = ''
${builtins.readFile ./functions/ssh.fish}
'';
};
}

View file

@ -0,0 +1,13 @@
set -l last_command_status $status
set -l symbol 'τ'
set -l normal_color (set_color normal)
set -l symbol_color (set_color blue -o)
set -l error_color (set_color red -o)
if test $last_command_status -eq 0
echo -n -s $symbol_color $symbol " " $normal_color
else
echo -n -s $error_color $symbol " " $normal_color
end

View file

@ -0,0 +1,61 @@
set -l cwd
set -l cwd_color (set_color blue)
set -l normal_color (set_color normal)
set -l branch_color (set_color yellow)
set -l meta_color (set_color red)
if git_is_repo
echo -n -s $branch_color (git_branch_name) $normal_color
set -l git_meta ""
if test (command git ls-files --others --exclude-standard | wc -w 2> /dev/null) -gt 0
set git_meta "$git_meta?"
end
if test (command git rev-list --walk-reflogs --count refs/stash 2> /dev/null)
set git_meta "$git_meta\$"
end
if git_is_touched
git_is_dirty && set git_meta "$git_meta"
git_is_staged && set git_meta "$git_meta"
end
set -l commit_count (command git rev-list --count --left-right (git remote)/(git_branch_name)"...HEAD" 2> /dev/null)
if test $commit_count
set -l behind (echo $commit_count | cut -f 1)
set -l ahead (echo $commit_count | cut -f 2)
if test $behind -gt 0
set git_meta "$git_meta🠋"
end
if test $ahead -gt 0
set git_meta "$git_meta🠉"
end
end
if test $git_meta
echo -n -s $meta_color " " $git_meta " " $normal_color
else
echo -n -s " "
end
set root_folder (command git rev-parse --show-toplevel 2> /dev/null)
set parent_root_folder (dirname $root_folder)
set cwd (echo $PWD | sed -e "s|$parent_root_folder/||")
else
set cwd (prompt_pwd)
end
echo -n -s $cwd_color "$cwd"
set_color --dim
set -l S (math $CMD_DURATION/1000)
set -l M (math $S/60)
echo -n -s " "
if test $M -gt 1
echo -n -s $M m
else if test $S -gt 1
echo -n -s $S s
else
echo -n -s $CMD_DURATION ms
end
set_color normal

View file

@ -0,0 +1,4 @@
git_is_repo; and begin
command git symbolic-ref --short HEAD 2> /dev/null;
or command git show-ref --head -s --abbrev | head -n1 2> /dev/null
end

View file

@ -0,0 +1 @@
git_is_worktree; and not command git diff --no-ext-diff --quiet --exit-code

View file

@ -0,0 +1,5 @@
test -d .git
or begin
set -l info (command git rev-parse --git-dir --is-bare-repository 2>/dev/null)
and test $info[2] = false
end

View file

@ -0,0 +1,3 @@
git_is_repo; and begin
not command git diff --cached --no-ext-diff --quiet --exit-code
end

View file

@ -0,0 +1,6 @@
git_is_worktree; and begin
# The first checks for staged changes, the second for unstaged ones.
# We put them in this order because checking staged changes is *fast*.
not command git diff-index --cached --quiet HEAD -- >/dev/null 2>&1
or not command git diff --no-ext-diff --quiet --exit-code >/dev/null 2>&1
end

View file

@ -0,0 +1,2 @@
git_is_repo
and test (command git rev-parse --is-inside-git-dir) = false

View file

@ -0,0 +1,30 @@
# Block nesting of nnn in subshells
if test -n "$NNNLVL"
if [ (expr $NNNLVL + 0) -ge 1 ]
exit
return
end
end
# The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
# To cd on quit only on ^G, remove the "-x" as in:
# set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
# NOTE: NNN_TMPFILE is fixed, should not be modified
if test -n "$XDG_CONFIG_HOME"
set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
else
set -x NNN_TMPFILE "$HOME/.config/nnn/.lastd"
end
# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn
# stty start undef
# stty stop undef
# stty lwrap undef
# stty lnext undef
nnn -T v $argv
if test -e $NNN_TMPFILE
source $NNN_TMPFILE
rm $NNN_TMPFILE
end

View file

@ -0,0 +1 @@
command ssh -o IPQoS=0 $argv;

11
programs/nnn/default.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
programs.nnn.enable = true;
home.sessionVariables = {
NNN_FCOLORS = "0000E6310000000000000000";
NNN_OPTS = "eH";
NNN_FIFO = "/tmp/nnn.fifo";
NNN_TRASH = "1";
};
}

View file

@ -0,0 +1,8 @@
{ config, pkgs, ... }:
{
programs.pywal.enable = true;
home.packages = with pkgs; [
pywalfox # Update librewolf's colorscheme based on pywal
];
}

30
programs/rofi/default.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, pkgs, ... }:
{
programs.rofi.enable = true;
programs.rofi.package = pkgs.rofi-wayland;
programs.wofi.settings = {
show = "dmenu"; # Default to dmenu
prompt = "";
hide_scroll = true;
insensitive = true;
location = "bottom_right";
dynamic_lines = true;
yoffset = -100;
xoffset = -40;
height = "50%";
width = "50%";
};
programs.wofi.style = ''
window {
background: rgba(0, 0, 0, 255);
font-size: 4rem;
}
#entry, #input {
margin: 2px;
background: #FFFFFF;
border-width: 2px;
border-color: #000000;
}
'';
}