ref(nix): mkOptions

This commit is contained in:
Léana 江 2024-02-27 01:23:20 +01:00 committed by Léana 江
parent d98d30916b
commit 989d025f56
42 changed files with 80 additions and 78 deletions

View file

@ -0,0 +1,18 @@
{
programs.atuin = {
enable = true;
flags = ["--disable-up-arrow"];
settings = {
history_filter = [
# privacy
"^echo"
"-----BEGIN PGP PRIVATE KEY BLOCK-----"
# idiot protection
"^rm -rf"
];
style = "full";
show_preview = true;
};
};
}

View file

@ -0,0 +1,212 @@
#? Config file for btop v. 1.2.13
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
color_theme = "onedark.theme"
#* If the theme set background should be shown, set to False if you want terminal background transparency.
theme_background = True
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
truecolor = True
#* Set to true to force tty mode regardless if a real tty has been detected or not.
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
force_tty = False
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
#* Use whitespace " " as separator between different presets.
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
vim_keys = True
#* Rounded corners on boxes, is ignored if TTY mode is ON.
rounded_corners = False
#* Default symbols to use for graph creation, "braille", "block" or "tty".
#* "braille" offers the highest resolution but might not be included in all fonts.
#* "block" has half the resolution of braille but uses more common characters.
#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY.
#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view.
graph_symbol = "braille"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_cpu = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_mem = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_net = "default"
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
graph_symbol_proc = "default"
#* Manually set which boxes to show. Available values are "cpu mem net proc", separate values with whitespace.
shown_boxes = "mem net cpu"
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
update_ms = 500
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
proc_sorting = "memory"
#* Reverse sorting order, True or False.
proc_reversed = False
#* Show processes as a tree.
proc_tree = False
#* Use the cpu graph colors in the process list.
proc_colors = True
#* Use a darkening gradient in the process list.
proc_gradient = True
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
proc_per_core = False
#* Show process memory as bytes instead of percent.
proc_mem_bytes = True
#* Show cpu graph for each process.
proc_cpu_graphs = True
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
proc_info_smaps = False
#* Show proc box on left side of screen instead of right.
proc_left = False
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
proc_filter_kernel = False
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
#* Select from a list of detected attributes from the options menu.
cpu_graph_upper = "total"
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
#* Select from a list of detected attributes from the options menu.
cpu_graph_lower = "total"
#* Toggles if the lower CPU graph should be inverted.
cpu_invert_lower = True
#* Set to True to completely disable the lower CPU graph.
cpu_single_graph = False
#* Show cpu box at bottom of screen instead of top.
cpu_bottom = False
#* Shows the system uptime in the CPU box.
show_uptime = True
#* Show cpu temperature.
check_temp = True
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
cpu_sensor = "Auto"
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
show_coretemp = True
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries.
#* Example: "4:0 5:1 6:3"
cpu_core_map = ""
#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine".
temp_scale = "celsius"
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
base_10_sizes = False
#* Show CPU frequency.
show_cpu_freq = True
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
clock_format = "%X"
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
background_update = True
#* Custom cpu model name, empty string to disable.
custom_cpu_name = ""
#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ".
#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user".
disks_filter = ""
#* Show graphs instead of meters for memory values.
mem_graphs = True
#* Show mem box below net box instead of above.
mem_below_net = False
#* Count ZFS ARC in cached and available memory.
zfs_arc_cached = True
#* If swap memory should be shown in memory box.
show_swap = True
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
swap_disk = True
#* If mem box should be split to also show disks info.
show_disks = True
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
only_physical = True
#* Read disks list from /etc/fstab. This also disables only_physical.
use_fstab = True
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
zfs_hide_datasets = False
#* Set to true to show available disk space for privileged users.
disk_free_priv = False
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
show_io_stat = True
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
io_mode = False
#* Set to True to show combined read/write io graphs in io mode.
io_graph_combined = False
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
#* Example: "/mnt/media:100 /:20 /boot:1".
io_graph_speeds = ""
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
net_download = 100
net_upload = 100
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
net_auto = True
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
net_sync = True
#* Starts with the Network Interface specified here.
net_iface = ""
#* Show battery stats in top right if battery is present.
show_battery = True
#* Which battery to use if multiple are present. "Auto" for auto detection.
selected_battery = "Auto"
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
log_level = "WARNING"

View file

@ -0,0 +1,81 @@
# Theme: OneDark
# By: Vitor Melo
# Main bg
theme[main_bg]="#282c34"
# Main text color
theme[main_fg]="#abb2bf"
# Title color for boxes
theme[title]="#abb2bf"
# Higlight color for keyboard shortcuts
theme[hi_fg]="#61afef"
# Background color of selected item in processes box
theme[selected_bg]="#2c313c"
# Foreground color of selected item in processes box
theme[selected_fg]="#abb2bf"
# Color of inactive/disabled text
theme[inactive_fg]="#5c6370"
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#61afef"
# Cpu box outline color
theme[cpu_box]="#5c6370"
# Memory/disks box outline color
theme[mem_box]="#5c6370"
# Net up/down box outline color
theme[net_box]="#5c6370"
# Processes box outline color
theme[proc_box]="#5c6370"
# Box divider line and small boxes line color
theme[div_line]="#5c6370"
# Temperature graph colors
theme[temp_start]="#98c379"
theme[temp_mid]="#e5c07b"
theme[temp_end]="#e06c75"
# CPU graph colors
theme[cpu_start]="#98c379"
theme[cpu_mid]="#e5c07b"
theme[cpu_end]="#e06c75"
# Mem/Disk free meter
theme[free_start]="#98c379"
theme[free_mid]="#e5c07b"
theme[free_end]="#e06c75"
# Mem/Disk cached meter
theme[cached_start]="#98c379"
theme[cached_mid]="#e5c07b"
theme[cached_end]="#e06c75"
# Mem/Disk available meter
theme[available_start]="#98c379"
theme[available_mid]="#e5c07b"
theme[available_end]="#e06c75"
# Mem/Disk used meter
theme[used_start]="#98c379"
theme[used_mid]="#e5c07b"
theme[used_end]="#e06c75"
# Download graph colors
theme[download_start]="#98c379"
theme[download_mid]="#e5c07b"
theme[download_end]="#e06c75"
# Upload graph colors
theme[upload_start]="#98c379"
theme[upload_mid]="#e5c07b"
theme[upload_end]="#e06c75"

View file

@ -0,0 +1,10 @@
{
programs.btop.enable = true;
# Link manually to get the theme along with the config
home.file.btop = {
recursive = true;
source = ./btop;
target = ".config/btop";
};
}

View file

@ -0,0 +1,108 @@
colorscheme spotify
set aaa_mode=album
set confirm_run=true
set continue=true
set continue_album=true
set follow=true
# distortion fix https://github.com/cmus/cmus/issues/1130#issuecomment-1003324193
set output_plugin=ao
bind -f browser - browser-up
bind -f browser i toggle show_hidden
bind -f browser space win-activate
bind -f browser u win-update
bind -f common ! push shell
bind -f common / search-start
bind -f common 1 view tree
bind -f common 2 view sorted
bind -f common 3 view playlist
bind -f common 4 view queue
bind -f common 5 view browser
bind -f common 6 view filters
bind -f common 7 view settings
bind -f common < seek -1m
bind -f common = vol +10%
bind -f common > seek +1m
bind -f common ? search-b-start
bind -f common B player-prev-album
bind -f common C toggle continue
bind -f common D win-remove
bind -f common F push filter
bind -f common G win-bottom
bind -f common K echo {}
bind -f common L push live-filter
bind -f common M toggle play_library
bind -f common N search-prev
bind -f common P win-mv-before
bind -f common Q win-add-Q
bind -f common U win-update-cache
bind -f common W player-next-album
bind -f common [ vol +1% +0
bind -f common ] vol +0 +1%
bind -f common ^B win-page-up
bind -f common ^C echo Type :quit<enter> to exit cmus.
bind -f common ^D win-half-page-down
bind -f common ^E win-scroll-down
bind -f common ^F win-page-down
bind -f common ^L refresh
bind -f common ^R toggle repeat_current
bind -f common ^U win-half-page-up
bind -f common ^Y win-scroll-up
bind -f common a win-add-l
bind -f common b player-prev
bind -f common c player-pause
bind -f common delete win-remove
bind -f common down win-down
bind -f common end win-bottom
bind -f common enter win-activate
bind -f common f toggle follow
bind -f common g win-top
bind -f common h seek -5
bind -f common home win-top
bind -f common i win-sel-cur
bind -f common j win-down
bind -f common k win-up
bind -f common l seek +5
bind -f common left seek -5
bind -f common m toggle aaa_mode
bind -f common mlb_click_bar player-pause
bind -f common mlb_click_selected win-activate
bind -f common mouse_scroll_down win-down
bind -f common mouse_scroll_down_bar seek -5
bind -f common mouse_scroll_down_title right-view
bind -f common mouse_scroll_up win-up
bind -f common mouse_scroll_up_bar seek +5
bind -f common mouse_scroll_up_title left-view
bind -f common n search-next
bind -f common o toggle play_sorted
bind -f common p win-mv-after
bind -f common page_down win-page-down
bind -f common page_up win-page-up
bind -f common q win-add-q
bind -f common r toggle repeat
bind -f common right seek +5
bind -f common s toggle shuffle
bind -f common space win-toggle
bind -f common t toggle show_remaining_time
bind -f common tab win-next
bind -f common u update-cache
bind -f common up win-up
bind -f common v player-stop
bind -f common w player-next
bind -f common x player-play
bind -f common y win-add-p
bind -f common { vol -1% -0
bind -f common } vol -0 -1%
fset 90s=date>=1990&date<2000
fset classical=genre="Classical"
fset missing-tag=!stream&(artist=""|album=""|title=""|tracknumber=-1|date=-1)
fset mp3=filename="*.mp3"
fset ogg=filename="*.ogg"
fset ogg-or-mp3=ogg|mp3
fset unheard=play_count=0
factivate
set status_display_program=cmusfm

View file

@ -0,0 +1,107 @@
colorscheme spotify
set aaa_mode=album
set confirm_run=true
set continue=true
set continue_album=true
set follow=true
set output_plugin=alsa
bind -f browser - browser-up
bind -f browser i toggle show_hidden
bind -f browser space win-activate
bind -f browser u win-update
bind -f common ! push shell
bind -f common / search-start
bind -f common 1 view tree
bind -f common 2 view sorted
bind -f common 3 view playlist
bind -f common 4 view queue
bind -f common 5 view browser
bind -f common 6 view filters
bind -f common 7 view settings
bind -f common < seek -1m
bind -f common = vol +10%
bind -f common > seek +1m
bind -f common ? search-b-start
bind -f common B player-prev-album
bind -f common C toggle continue
bind -f common D win-remove
bind -f common F push filter
bind -f common G win-bottom
bind -f common K echo {}
bind -f common L push live-filter
bind -f common M toggle play_library
bind -f common N search-prev
bind -f common P win-mv-before
bind -f common Q win-add-Q
bind -f common U win-update-cache
bind -f common W player-next-album
bind -f common [ vol +1% +0
bind -f common ] vol +0 +1%
bind -f common ^B win-page-up
bind -f common ^C echo Type :quit<enter> to exit cmus.
bind -f common ^D win-half-page-down
bind -f common ^E win-scroll-down
bind -f common ^F win-page-down
bind -f common ^L refresh
bind -f common ^R toggle repeat_current
bind -f common ^U win-half-page-up
bind -f common ^Y win-scroll-up
bind -f common a win-add-l
bind -f common b player-prev
bind -f common c player-pause
bind -f common delete win-remove
bind -f common down win-down
bind -f common end win-bottom
bind -f common enter win-activate
bind -f common f toggle follow
bind -f common g win-top
bind -f common h seek -5
bind -f common home win-top
bind -f common i win-sel-cur
bind -f common j win-down
bind -f common k win-up
bind -f common l seek +5
bind -f common left seek -5
bind -f common m toggle aaa_mode
bind -f common mlb_click_bar player-pause
bind -f common mlb_click_selected win-activate
bind -f common mouse_scroll_down win-down
bind -f common mouse_scroll_down_bar seek -5
bind -f common mouse_scroll_down_title right-view
bind -f common mouse_scroll_up win-up
bind -f common mouse_scroll_up_bar seek +5
bind -f common mouse_scroll_up_title left-view
bind -f common n search-next
bind -f common o toggle play_sorted
bind -f common p win-mv-after
bind -f common page_down win-page-down
bind -f common page_up win-page-up
bind -f common q win-add-q
bind -f common r toggle repeat
bind -f common right seek +5
bind -f common s toggle shuffle
bind -f common space win-toggle
bind -f common t toggle show_remaining_time
bind -f common tab win-next
bind -f common u update-cache
bind -f common up win-up
bind -f common v player-stop
bind -f common w player-next
bind -f common x player-play
bind -f common y win-add-p
bind -f common { vol -1% -0
bind -f common } vol -0 -1%
fset 90s=date>=1990&date<2000
fset classical=genre="Classical"
fset missing-tag=!stream&(artist=""|album=""|title=""|tracknumber=-1|date=-1)
fset mp3=filename="*.mp3"
fset ogg=filename="*.ogg"
fset ogg-or-mp3=ogg|mp3
fset unheard=play_count=0
factivate
set status_display_program=cmusfm

View file

@ -0,0 +1,23 @@
{
pkgs,
lib,
config,
...
}: {
home = lib.optionalAttrs config.cmus.enable {
packages = with pkgs; [
cmus
cmusfm
];
file.cmus = {
recursive = true;
source = let
inherit (pkgs.stdenv) isLinux;
in
if isLinux
then ./cmus-linux
else ./cmus-darwin;
target = ".config/cmus";
};
};
}

76
nix/home/_/default.nix Normal file
View file

@ -0,0 +1,76 @@
{
pkgs,
unstable,
mypkgs,
config,
lib,
...
}: {
imports = [
./fish
./direnv
./atuin
./starship
./fzf
./git
./btop
./tmux
./neovim
./vim
./cmus
];
programs.home-manager.enable = true;
home = {
username = lib.mkDefault "leana";
homeDirectory = lib.mkDefault "/home/leana";
stateVersion = "23.11";
};
programs = {
ripgrep.enable = true;
gpg.enable = true;
};
home.packages = with pkgs;
[
# shell and script dependencies
figlet
gnused
stow
fd
vivid
gcc
rsync
# coreutils
uutils-coreutils-noprefix
parallel
# nix
alejandra
# utils
tree
tldr
irssi
]
++ lib.lists.optionals config.extraUtils.enable [
unstable.opam
unstable.cargo
hyperfine
watchexec
tea
tokei
gnumake
sd
]
++ lib.lists.optionals config.universityTools.enable [
mypkgs.logisim-evolution
mypkgs.necrolib
pkgs.rars
];
}

View file

@ -0,0 +1,15 @@
{config, ...}: {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = let
home = config.home.homeDirectory;
in
builtins.fromTOML ''
[global]
strict_env = true
[whitelist]
prefix = [ "${home}/repos", "${home}/univ-repos", "${home}/playground" ]
'';
};
}

View file

@ -0,0 +1,87 @@
{pkgs, ...}: let
inherit (pkgs.stdenv) isLinux;
abbrs = {
## Docker
dc = "docker compose";
## Git
gaa = "git add (git rev-parse --show-toplevel)";
"ga." = "git add .";
grg = "git remote get-url";
gra = "git remote add";
gc = "git commit";
gca = "git commit --amend";
gs = "git stash --all";
gp = "git pull";
gP = "git push";
gb = "git blame -C -C -C";
clone = "clone_to_repos";
## Editor
ts = "tmux_sessionizer";
ta = "tmux_attach";
v = "nvim";
":q" = "exit";
## Preferences
np = "cd ~/.dotfiles/nix && $EDITOR flake.nix && prevd";
vp = "cd ~/.dotfiles/.config/nvim && $EDITOR init.lua && prevd";
xp = "cd ~/.dotfiles/.config/xmonad && $EDITOR xmonad.hs && prevd";
# Home-Manager / NixOS
ns = "sudo nixos-rebuild switch -L --flake ~/.dotfiles/nix#carbon";
hp = "cd ~/.dotfiles/.config/home-manager && $EDITOR flake.nix && prevd";
hs = "home-manager switch -L --flake ~/.dotfiles/nix#bismuth";
nsh = "nix-shell -p";
};
abbrsLinux = {
ss = "sudo systemctl";
se = "sudoedit";
};
abbrsMacos = {};
aliases = {
rm = "rm -i"; # idiot protection
tree = "tree -Cph";
restow = "cd ~/.dotfiles/ && stow -D . && stow -S . && prevd";
nix-shell = "nix-shell --run fish";
};
aliasesLinux = {
chmod = "chmod --preserve-root";
chown = "chown --preserve-root";
sudoedit = "SUDO_EDITOR=(which nvim) sudoedit";
};
aliasesMacos = {
hide_desktop = ''
defaults write com.apple.finder CreateDesktop false; killall Finder
'';
show_desktop = ''
defaults write com.apple.finder CreateDesktop true; killall Finder
'';
reset_launchpad = ''
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock
'';
add_spacer_tile = ''
defaults write com.apple.dock persistent-apps -array-add \'{tile-type="small-spacer-tile";}\'; killall Dock
'';
};
in {
programs.fish = {
shellAbbrs =
abbrs
// (
if isLinux
then abbrsLinux
else abbrsMacos
);
shellAliases =
aliases
// (
if isLinux
then aliasesLinux
else aliasesMacos
);
};
}

View file

@ -0,0 +1,11 @@
for mode in default insert
bind --mode $mode \cg tmux_home
bind --mode $mode \cf tmux_sessionizer
end
# vi cursor style
fish_vi_key_bindings
set fish_cursor_default block
set fish_cursor_insert line
set fish_cursor_replace_one underscore
set fish_cursor_visual block

View file

@ -0,0 +1,100 @@
# Learn more: https://fishshell.com/docs/current/interactive.html
begin
# scope this in a bolck to not leak variables everywhere
set -l black 000000
set -l grey a0a1a7
set -l cyan 0184bc
set -l blue 4078f2
set -l purple a626a4
set -l green 50a14f
set -l orange e45649
set -l red ca1243
set -l brown 986801
set -l gold c18401
set -l accent 645199
set -l visual d0d0d0
###########
# General #
###########
# default color
set fish_color_normal $black
# commands like echo
set fish_color_command $blue
# keywords like if - this falls back on the command color if unset
set fish_color_keyword $purple
# quoted text like "abc"
set fish_color_quote $green
# IO redirections like >/dev/null
set fish_color_redirection $gold
# process separators like ; and &
set fish_color_end $black --bold
# syntax errors
set fish_color_error $black
# ordinary command parameters
set fish_color_param $red
# parameters that are filenames (if the file exists)
set fish_color_valid_path --italics
# options starting with “-”, up to the first “--” parameter
set fish_color_option $cyan
# comments like # important
set fish_color_comment $grey
# selected text in vi visual mode
set fish_color_selection --background=$visual
# parameter expansion operators like * and ~
set fish_color_operator $orange
# character escapes like \n and \x70
set fish_color_escape $purple
# autosuggestions (the proposed rest of a command)
set fish_color_autosuggestion $grey
# The current working directory in the default prompt
set fish_color_cwd $black
# The current working directory in the default prompt for the root user
set fish_color_cwd_root $red
# The username in the default prompt
set fish_color_user $grey
# The hostname in the default prompt
set fish_color_host $black
# the hostname in the default prompt for remote sessions (like ssh)
set fish_color_host_remote $red
# the last commands nonzero exit code in the default prompt
set fish_color_status $red
# the ^C indicator on a canceled command
set fish_color_cancel $accent --reverse
# history search matches and selected pager items (background only)
set fish_color_search_match --background $visual
#########
# Pager #
#########
# the progress bar at the bottom left corner
set fish_pager_color_progress --reverse $cyan
# the background color of a line
set fish_pager_color_background $black
# the prefix string, i.e. the string that is to be completed
set fish_pager_color_prefix $black
# the completion itself, i.e. the proposed rest of the string
set fish_pager_color_completion $grey
# the completion description
set fish_pager_color_description $grey
# background of the selected completion
set fish_pager_color_selected_background $black
# prefix of the selected completion
set fish_pager_color_selected_prefix
# suffix of the selected completion
set fish_pager_color_selected_completion $red
# description of the selected completion
set fish_pager_color_selected_description $gold
# ## Alternating colors
# # background of every second unselected completion
# set fish_pager_color_secondary_background --background=$tinted_bg
# # prefix of every second unselected completion
# set fish_pager_color_secondary_prefix
# # suffix of every second unselected completion
# set fish_pager_color_secondary_completion
# # description of every second unselected completion
# set fish_pager_color_secondary_description
end

View file

@ -0,0 +1,6 @@
# fzf preview theme (use delta instead of bat)
set -x fzf_preview_file_cmd 'delta'
# fd uses LS_COLORS
set -x LS_COLORS (vivid -m 24-bit generate one-light)
# fzf-fish search hidden files
set -x fzf_fd_opts --hidden --exclude=.git

View file

@ -0,0 +1,14 @@
# zh_TW
# set -x LANG zh_TW.UTF-8
# set -x LANGUAGE zh_TW
# set -x LC_ALL zh_TW.UTF-8
# fr_FR
# set -x LANG fr_FR.UTF-8
# set -x LANGUAGE fr_FR
# set -x LC_ALL fr_FR.UTF-8
# en_US
set -x LANG en_US.UTF-8
set -x LANGUAGE en_US
set -x LC_ALL en_US.UTF-8

View file

@ -0,0 +1,6 @@
# repo paths
set REPOS_PATH ~/repos
set UNIV_REPOS_PATH ~/univ-repos
set PLAYGROUND_PATH ~/playground
set CODEWARS_PATH ~/codewars
set ZEROJUDGE_PATH ~/zerojudge

View file

@ -0,0 +1,76 @@
{pkgs, ...}: {
imports = [./aliasesAbbrs.nix];
programs.fish = let
inherit (builtins) readFile foldl' map listToAttrs concatMap;
readConfig = n: readFile ./conf.d/${n}.fish;
readConfigs = ns:
foldl' (l: r: l + "\n" + r) ""
(map readConfig ns);
in {
enable = true;
shellInit = readConfig "shellInit";
interactiveShellInit =
readConfigs ["interactiveShellInit" "bind" "colorscheme" "locale"];
functions = let
makeFishFunctions = ns:
listToAttrs (
concatMap (n: [
{
name = n;
value = readFile ./functions/${n}.fish;
}
])
ns
);
in
makeFishFunctions [
"clone_to_repos"
"file_extension"
"file_mantissa"
"fish_command_not_found"
"fish_greeting"
"fish_remove_path"
"largest-objects-in-repo"
"snakecase"
"timestamp"
"tmux_attach"
"tmux_home"
"tmux_last"
"tmux_sessionizer"
"update_dotfiles"
];
plugins = [
{
name = "fzf-fish";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "fzf.fish";
rev = "e5d54b93cd3e096ad6c2a419df33c4f50451c900";
sha256 = "sha256-5cO5Ey7z7KMF3vqQhIbYip5JR6YiS2I9VPRd6BOmeC8=";
};
}
{
name = "colored-man-pages";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "colored_man_pages.fish";
rev = "f885c2507128b70d6c41b043070a8f399988bc7a";
sha256 = "sha256-ii9gdBPlC1/P1N9xJzqomrkyDqIdTg+iCg0mwNVq2EU=";
};
}
{
name = "sponge";
src = pkgs.fetchFromGitHub {
owner = "meaningful-ooo";
repo = "sponge";
rev = "384299545104d5256648cee9d8b117aaa9a6d7be";
sha256 = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w=";
};
}
];
};
}

View file

@ -0,0 +1,9 @@
if count $argv > /dev/null
set name_repo (echo $argv | sed -E 's/.*[:\/]([[:alnum:]._-]+)\/([[:alnum:]._-]+).git$/\1 \2/')
set name (echo $name_repo | cut -d ' ' -f1)
set repo (echo $name_repo | cut -d ' ' -f2)
mkdir -p $REPOS_PATH/$name
git clone $argv $REPOS_PATH/$name/$repo
else
echo "Please provide a git url"
end

View file

@ -0,0 +1,6 @@
if count $argv >/dev/null
echo (basename $argv) | sed 's/.*\(\.[^.]*$\)/\1/'
else
echo "Please supply a path"
return 1
end

View file

@ -0,0 +1,6 @@
if count $argv >/dev/null
echo (basename $argv) | sed 's/\.[^.]*$//'
else
echo "Please supply a path"
return 1
end

View file

@ -0,0 +1,14 @@
set hour (date +"%H")
set user (whoami)
set words \
"Are you drunk ??" \
"Il est seulement $hour heures" \
"Reveille-toi, $user" \
"Magique de vim !" \
"Magique de nix !" \
"As-tu ecris ton journal aujourd'hui ?"
set choice $words[(random 1 (count $words))]
echo -e $choice | figlet -c

View file

@ -0,0 +1,12 @@
set_color --italics
switch $FISH_GREETING
case "toh"
cat ~/.quotes/toh/* | shuf -n 1
case "fleabag"
cat ~/.quotes/fleabag/* | shuf -n 1
case "date"
date
case "citation"
~/.local/bin/citation.py
case "*"
end

View file

@ -0,0 +1,6 @@
if set index (contains -i $argv[1] $fish_user_path)
set --erase --universal fish_user_paths[$index]
echo "Updated fish_user_path: $fish_user_path"
else
echo "$argv[1] not found in fish_user_path: $fish_user_path"
end

View file

@ -0,0 +1,28 @@
# Shows you the largest objects in your repo's pack file. Written for osx.
# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# translated to fish with ChatGPT, reviewed by Léana :P
# set the internal field spereator to line break, so that we can iterate easily over the verify-pack output
set -x IFS "\n"
# list all objects including their size, sort by size, take top 10
set objects (git verify-pack -v .git/objects/pack/pack-*.idx | grep -v chain | sort -k3nr | head)
echo "All sizes are in kB. The pack column is the size of the object, compressed, inside the pack file."
set output "size,pack,SHA,location"
for obj in $objects
# extract the size in bytes
set size (math (echo $obj | cut -f 5 -d ' ') / 1024)
# extract the compressed size in bytes
set compressedSize (math (echo $obj | cut -f 6 -d ' ') / 1024)
# extract the SHA
set sha (echo $obj | cut -f 1 -d ' ')
# find the objects location in the repository tree
set other (git rev-list --all --objects | grep $sha)
#lineBreak=`echo -e "\n"`
set output "$output\n$size,$compressedSize,$other"
end
echo -e $output | column -t -s ', '

View file

@ -0,0 +1 @@
echo $argv | sed -E 's/[^A-Za-z0-9_\n]+/_/g' | sed -E 's/__+/_/g' | tr '[:upper:]' '[:lower:]'

View file

@ -0,0 +1 @@
date +%s

View file

@ -0,0 +1,21 @@
# abandon if tmux not running
set tmux_running (pgrep tmux)
if [ -z "$tmux_running" ]
return 0
end
set selected (tmux list-sessions -F "#{session_name}" | fzf)
if [ -z $selected ]
return 0
end
# echo "---attach---" >> /tmp/TMUX_DEBUG
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
echo (tmux display-message -p '#S') > /tmp/TMUX_LAST
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
if [ -z $TMUX ]
tmux attach-session -t $selected
else
tmux switch-client -t $selected
end

View file

@ -0,0 +1,18 @@
# echo "---home---" >> /tmp/TMUX_DEBUG
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
echo (tmux display-message -p '#S') > /tmp/TMUX_LAST
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
# create session if doesn't exist
if ! tmux has-session -t="home" 2> /dev/null
tmux \
new-session -ds "home" \; \
new-window -t "home" \; \
select-window -t "home":1
end
if [ -z $TMUX ]
tmux attach-session -t "home"
else
tmux switch-client -t "home"
end

View file

@ -0,0 +1,19 @@
# create session if doesn't exist
set session_name (cat /tmp/TMUX_LAST)
if ! tmux has-session -t=$session_name 2> /dev/null
tmux \
new-session -ds $session_name \; \
new-window -t $session_name \; \
select-window -t $session_name:1
end
# echo "---last---" >> /tmp/TMUX_DEBUG
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
echo (tmux display-message -p '#S') > /tmp/TMUX_LAST
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
if [ -z $TMUX ]
tmux attach-session -t $session_name
else
tmux switch-client -t $session_name
end

View file

@ -0,0 +1,48 @@
# Inspired by the one and only primeagen
set selected \
(begin
# use fd even though it's an extra dependency because find is too slow
fd . $REPOS_PATH $UNIV_REPOS_PATH --exact-depth 2 --type d;
fd . $PLAYGROUND_PATH --exact-depth 1 --type d;
echo "play"
end 2> /dev/null | sed -e "s|^$HOME|~|" | fzf)
set selected (echo $selected | sed -e "s|^~|$HOME|")
if [ -z $selected ]
commandline --function repaint
return 0
end
switch $selected
case "play"
read -P "Give it a name: " name
if test -z $name
return 0
else
set name (snakecase $name)
set selected ~/playground/$name/
mkdir -p $selected
end
end
set session_name (echo $selected | tr . _)
# echo "---sess---" >> /tmp/TMUX_DEBUG
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
echo (tmux display-message -p '#S') > /tmp/TMUX_LAST
# echo (cat /tmp/TMUX_LAST) >> /tmp/TMUX_DEBUG
# create session if doesn't exist
if ! tmux has -t=$session_name 2> /dev/null
tmux \
new-session -ds $session_name -c $selected \; \
send-keys -t $session_name $EDITOR ENTER \; \
new-window -t $session_name -c $selected \; \
select-window -t $session_name:1 \;
end
if [ -z $TMUX ]
tmux attach-session -t $session_name
else
tmux switch-client -t $session_name
end

View file

@ -0,0 +1,6 @@
cd ~/.dotfiles/
git reset --hard
git pull --set-upstream origin main
git submodule update --init
prevd
restow

View file

@ -0,0 +1,16 @@
{
programs.fzf = {
enable = true;
enableFishIntegration = true;
defaultOptions = [
"--cycle"
"--border=none"
"--preview-window=wrap"
"--color=fg:#000000,bg:#eeeeee,hl:#ca1243"
"--color=fg+:#000000,bg+:#d0d0d0,hl+:#ca1243"
"--color=info:#0184bc,prompt:#645199,pointer:#645199"
"--color=marker:#0184bc,spinner:#645199,header:#645199"
"--color=gutter:#eeeeee"
];
};
}

View file

@ -0,0 +1,60 @@
{
# git plugins
programs.git = {
lfs = {
enable = true;
skipSmudge = true;
};
delta = {
enable = true;
options = {
syntax-theme = "OneHalfLight";
features = "side-by-side";
};
};
};
# git itself
programs.git = {
enable = true;
extraConfig = {
init.defaultBranch = "mistress"; # haha gay haha
push.autoSetupRemote = true;
pull.ff = "only";
rerere.enabled = true;
safe.directory = "/etc/docker/compose";
};
ignores = [
"*~"
"*.swp"
".direnv/"
".DS_Store"
];
};
# identity
programs.git = {
userEmail = "leana.jiang@icloud.com";
userName = "Léana ";
signing = {
key = "3659D5C87A4BC5D7699B37D84E887A4CA9714ADA";
signByDefault = true;
};
};
# university identity
programs.git.includes = [
{
condition = "gitdir:~/univ-repos/";
contents = {
init.defaultBranch = "main";
user = {
name = "Léana CHIANG";
email = "leana.chiang@etudiant.univ-rennes.fr";
signingKey = "EB544A6442B3B6CE88CD859732035DB97E777EEB";
};
commit.gpgSign = true;
};
}
];
}

View file

@ -0,0 +1,40 @@
{
config,
pkgs,
lib,
...
}: {
programs.neovim = {
enable = true;
defaultEditor = true;
extraPackages = with pkgs;
[
lua-language-server
stylua
nodePackages.bash-language-server
shellcheck
nil
]
++ lib.lists.optionals config.extraLanguageServers.enable [
nodePackages.vim-language-server
vscode-langservers-extracted # HTML/CSS/JSON/ESLint
marksman
nodePackages.pyright
taplo
];
};
home.file = let
fr_utf-8_spl = builtins.fetchurl {
url = "http://ftp.vim.org/vim/runtime/spell/fr.utf-8.spl";
sha256 = "abfb9702b98d887c175ace58f1ab39733dc08d03b674d914f56344ef86e63b61";
};
fr_utf-8_sug = builtins.fetchurl {
url = "http://ftp.vim.org/vim/runtime/spell/fr.utf-8.sug";
sha256 = "0294bc32b42c90bbb286a89e23ca3773b7ef50eff1ab523b1513d6a25c6b3f58";
};
in {
"${config.xdg.configHome}/nvim/spell/fr.utf-8.spl".source = fr_utf-8_spl;
"${config.xdg.configHome}/nvim/spell/fr.utf-8.sug".source = fr_utf-8_sug;
};
}

View file

@ -0,0 +1,9 @@
{
programs.starship = let
inherit (builtins) readFile;
in {
enable = true;
enableFishIntegration = true;
settings = fromTOML (readFile ./starship.toml);
};
}

View file

@ -0,0 +1,88 @@
"$schema" = 'https://starship.rs/config-schema.json'
format = '''
$status$hostname$directory$python$username$nix_shell
$character
'''
right_format = '$cmd_duration$git_state$git_branch$git_commit$git_status'
palette = 'curry'
[palettes.curry]
accent = '#645199' # Haskell purple
accent_trans = '#efebfc'
black = '#383A42'
grey = '#a0a1a7'
cyan = '#0184bc'
blue = '#4078f2'
purple = '#a626a4'
green = '#50a14f'
orange = '#e45649'
red = '#ca1243'
brown = '#986801'
gold = '#c18401'
tinted_bg = '#eeeeee'
[hostname]
ssh_only = true
style = 'bold orange'
format = '[$hostname]($style):'
[username]
style_root = 'bold orange'
style_user = 'grey'
format = '( [\($user\)]($style))'
[character]
success_symbol = '[\$](black)' # Insert
error_symbol = '[\$](black)' # Insert
vimcmd_symbol = '[N](grey)' # Normal
vimcmd_replace_symbol = '[R](grey)' # Replace
vimcmd_replace_one_symbol = '[R](grey)' # Replace
vimcmd_visual_symbol = '[V](grey)' # Visual
[directory]
truncation_length = 4
truncate_to_repo = false
style = 'fg:black bg:accent_trans'
format = '[$path]($style)( [$read_only]($read_only_style))'
read_only = ''
read_only_style = 'red'
truncation_symbol = '…/'
[status]
format = '([\[$status\]](bold red) )'
disabled = false
[python]
style = 'grey'
format = '( [\($virtualenv\)]($style))'
[cmd_duration]
min_time = 5_000
show_milliseconds = true
style = 'brown'
format = '([$duration]($style) )'
[git_state]
style = 'bold red'
format = '\([$state( $progress_current/$progress_total)]($style)\) '
[git_branch]
symbol = ''
style = 'grey'
format = '[$symbol$branch(:$remote_branch)]($style)'
[git_commit]
style = 'accent'
format = '[\(](grey)[$hash$tag]($style)[\)](grey)'
[git_status]
ahead = '⇡$count'
behind = '⇣$count'
diverged = '⇕⇡$ahead_count⇣$behind_count'
style = 'bold accent'
format = '([\[](grey)[$all_status$ahead_behind]($style)[\]](grey))'
[nix_shell]
format = '[( \($name\))]($style)'

View file

@ -0,0 +1,11 @@
{pkgs, ...}: {
programs.tmux = {
enable = true;
extraConfig =
''
set -g default-command "${pkgs.fish}/bin/fish" # Use fish
set -g default-shell "${pkgs.fish}/bin/fish"
''
+ builtins.readFile ./tmux.conf;
};
}

122
nix/home/_/tmux/tmux.conf Normal file
View file

@ -0,0 +1,122 @@
###########
# Options #
###########
set -s escape-time 0 # escape delay
set -g mouse on # mouse control
set -g focus-events on # focus-events for vim
set -g default-terminal "tmux-256color" # enable italics
set -g base-index 1 # start counting pane number from 1
set -g renumber-windows on # auto reorder window number
set -g mode-keys vi # global vi mode
set -g history-limit 10000 # I want more history
# Display style
set -g @FG "#000000"
set -g @BG "#fafafa"
set -g @GREY "#a0a1a7"
set -g @VISUAL "#dedede"
set -g @ACCENT "#645199"
set -g @RED "#ca1243"
set -g message-style "fg=#{@FG},bold,bg=#{@VISUAL}"
# status bar
set -g status-position top
set -g status-style "fg=#{@FG},bg=#{@VISUAL}"
set -g status-left "#{?window_name,#I:#W}"
set -g status-right "#(basename #S) [#(uname -n)]"
# window name
set -g window-status-style "fg=#{@GREY},bg=#{@VISUAL}"
set -g window-status-current-style "fg=#{@FG},bold,bg=#{@VISUAL}"
set -g window-status-format " #{pane_current_command}"
set -g window-status-current-format " #{pane_current_command}"
# pane border (separator)
set -g pane-border-style "fg=#{@VISUAL}"
set -g pane-active-border-style "fg=#{@ACCENT}"
############
# Bindings #
############
# remap prefix
bind C-a send-prefix
set -g prefix C-a
unbind C-b
# easy config reload (that bypasses nix too)
bind r source-file ~/.dotfiles/nix/home/common/tmux/tmux.conf \; display-message "tmux.conf reloaded."
# organic jumping
bind -n C-h select-window -t 1
bind -n C-t select-window -t 2
bind -n C-n select-window -t 3
bind -n C-s select-window -t 4
bind -T copy-mode-vi C-h select-window -t 1
bind -T copy-mode-vi C-t select-window -t 2
bind -T copy-mode-vi C-n select-window -t 3
bind -T copy-mode-vi C-s select-window -t 4
# stop the clock madness
unbind t
# vim-sytle pane jumping
bind h select-pane -L
bind l select-pane -R
bind j select-pane -D
bind k select-pane -U
# unbind built-in select-pane jumping
unbind Left
unbind Right
unbind Down
unbind Up
# improve window swapping
bind [ swap-window -d -t -1
bind ] swap-window -d -t +1
# Prime says the find window is for chumps. Don't use the find window
bind -n C-f popup -h 25 -w 70 -E "fish -c tmux_sessionizer"
bind -n C-g run-shell "fish -c tmux_home"
bind s run-shell "fish -c tmux_last"
# fast kill
bind C-k confirm-before kill-session
# pane movement
bind < command-prompt -p "join pane from:" "join-pane -s '%%'"
bind > command-prompt -p "send pane to:" "join-pane -t '%%'"
bind b command-prompt -p "break pane to " "break-pane -t '%%'"
# Disable toggle
# credit https://github.com/samoshkin/tmux-config/blob/master/tmux/tmux.conf
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set window-status-current-style "fg=#{@GREY},bold,bg=#{@VISUAL}" \;\
refresh-client -S
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
set -u status \;\
set window-status-current-style "fg=#{@FG},bold,bg=#{@VISUAL}" \;\
refresh-client -S
# Better copy
bind v copy-mode
bind -T copy-mode-vi v send-keys -X begin-selection
if-shell "uname | grep -q Darwin" {
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'pbcopy'
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'pbcopy'
} {
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
}
# if-shell "[ -n \"#{@SSH_CLIENT}\"]" {
# bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'ssh leana@10.0.0.10 pbcopy'
# bind-key -T copy-mode-vi 'Y' send -X copy-pipe-and-cancel 'ssh leana@10.66.66.10 pbcopy'
# }

View file

@ -0,0 +1,17 @@
{pkgs, ...}: {
programs.vim = let
inherit (builtins) readFile;
in {
enable = true;
extraConfig = readFile ./vimrc;
plugins = with pkgs.vimPlugins; [
vim-sleuth
vim-surround
vim-fugitive
vim-commentary
undotree
tabular
vim-wakatime
];
};
}

106
nix/home/_/vim/vimrc Normal file
View file

@ -0,0 +1,106 @@
set belloff=all
set hlsearch
set incsearch
set number
set relativenumber
set cursorline
set tabstop=4
set shiftwidth=4
set noexpandtab
set nowrap
set linebreak
set breakindent
set noswapfile
set nobackup
set undofile
set termguicolors
syntax on
set ignorecase
set smartcase
set autoindent
set smartindent
set scrolloff=3
set colorcolumn=80
"""""""""""
" Keymaps "
"""""""""""
let mapleader = " "
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
" Centered motions
nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>zz
nnoremap n nzzzv
nnoremap N Nzzzv
nnoremap J mzJ`z
" Better clipboard
nnoremap <Leader>d "_d
nnoremap <Leader>c "_dc
nnoremap <Leader>p "_dP
nnoremap <Leader>y "+y
xnoremap <Leader>d "_d
xnoremap <Leader>c "_dc
xnoremap <Leader>p "_dP
xnoremap <Leader>y "+y
vnoremap <Leader>d "_d
vnoremap <Leader>c "_dc
vnoremap <Leader>p "_dP
vnoremap <Leader>y "+y
" Linewrap jk
nnoremap j gj
nnoremap k gk
nnoremap <Down> g<Down>
nnoremap <Up> g<Up>
nnoremap <Leader>pv :Explore<CR> " Project View
nnoremap <Leader>nf :enew<CR> " New File
nnoremap <Leader>so :so %<CR> " Source buffer
cnoremap #capl \(.\{-}\) " helpers in regex
cnoremap #capm \(.*\)
nnoremap <Leader>+x :!chmod +x %<CR> " Permission
nnoremap <Leader>-x :!chmod -x %<CR>
nnoremap <Leader>w :setlocal invwrap<CR> " linewrap
nnoremap Q <nop>
"""""""""""""""""""
" Plugin mappings "
"""""""""""""""""""
" Fugitive
nmap <leader><space> :Git<CR>5<Down>
autocmd FileType fugitive nmap <buffer> <leader><space> :q<CR>
nmap <leader>gb :Git blame<CR>
autocmd FileType fugitiveblame nmap <buffer> <leader>gb :q<CR>
" Undotree
nmap <leader>u :UndotreeToggle<CR>:UndotreeFocus<CR>
autocmd FileType undotree nmap <buffer> <leader>u :q<CR>
" Tabular
nmap <leader>ta Tabularize /=<CR>
nmap <leader>tc Tabularize /:<CR>
nmap <leader>tC Tabularize trailing_c_comments<CR>
"""""""""""""""
" Colorscheme "
"""""""""""""""
" TODO: package paramount myself !
" colorscheme paramount