mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
nix: expose shared home manager configuration via homeModules
This commit is contained in:
parent
5155bd69e8
commit
5b95c43559
47 changed files with 45 additions and 29 deletions
19
nix/homeModules/atuin/default.nix
Normal file
19
nix/homeModules/atuin/default.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
programs.atuin = {
|
||||
enable = true;
|
||||
flags = [ "--disable-up-arrow" ];
|
||||
settings = {
|
||||
history_filter = [
|
||||
# privacy
|
||||
"^echo"
|
||||
"^-----BEGIN"
|
||||
"^mods"
|
||||
|
||||
# idiot protection
|
||||
"^rm -rf"
|
||||
];
|
||||
style = "full";
|
||||
show_preview = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
212
nix/homeModules/btop/btop/btop.conf
Normal file
212
nix/homeModules/btop/btop/btop.conf
Normal 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"
|
||||
81
nix/homeModules/btop/btop/themes/onedark.theme
Normal file
81
nix/homeModules/btop/btop/themes/onedark.theme
Normal 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"
|
||||
11
nix/homeModules/btop/default.nix
Normal file
11
nix/homeModules/btop/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
programs.btop.enable = true;
|
||||
|
||||
# Link manually to get the theme along with the config
|
||||
home.file.btop = lib.mkIf config.programs.btop.enable {
|
||||
recursive = true;
|
||||
source = ./btop;
|
||||
target = ".config/btop";
|
||||
};
|
||||
}
|
||||
31
nix/homeModules/cmus/default.nix
Normal file
31
nix/homeModules/cmus/default.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.programs.cmus.enable = lib.mkOption { default = false; };
|
||||
|
||||
config.home = lib.mkIf config.programs.cmus.enable {
|
||||
packages = [
|
||||
pkgs.cmus
|
||||
pkgs.cmusfm
|
||||
];
|
||||
file.cmus = {
|
||||
recursive = true;
|
||||
text = lib.mkMerge [
|
||||
(builtins.readFile ./rc)
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isLinux ''
|
||||
set output_plugin=alsa
|
||||
'')
|
||||
(lib.mkIf pkgs.stdenv.isDarwin ''
|
||||
# # distortion fix https://github.com/cmus/cmus/issues/1130#issuecomment-1003324193
|
||||
# set output_plugin=ao
|
||||
'')
|
||||
];
|
||||
target = "${config.xdg.configHome}/cmus/rc";
|
||||
};
|
||||
};
|
||||
}
|
||||
105
nix/homeModules/cmus/rc
Normal file
105
nix/homeModules/cmus/rc
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
colorscheme spotify
|
||||
|
||||
set aaa_mode=album
|
||||
set confirm_run=true
|
||||
set continue=true
|
||||
set continue_album=true
|
||||
set follow=true
|
||||
|
||||
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
|
||||
38
nix/homeModules/default.nix
Normal file
38
nix/homeModules/default.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
moduleNames = [
|
||||
"user-nixconf"
|
||||
"packages"
|
||||
|
||||
"fish"
|
||||
"direnv"
|
||||
"atuin"
|
||||
"kitty"
|
||||
"starship"
|
||||
"fzf"
|
||||
"btop"
|
||||
|
||||
"tmux"
|
||||
"git"
|
||||
"neovim"
|
||||
"vim"
|
||||
|
||||
"password-store"
|
||||
"gpg"
|
||||
|
||||
"cmus"
|
||||
];
|
||||
|
||||
eachModule = lib.attrsets.genAttrs moduleNames (name: ./${name});
|
||||
|
||||
allModules = {
|
||||
imports = map (name: ./${name}) moduleNames;
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
flake.homeModules = eachModule // {
|
||||
_ = allModules;
|
||||
};
|
||||
}
|
||||
17
nix/homeModules/direnv/default.nix
Normal file
17
nix/homeModules/direnv/default.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
config =
|
||||
let
|
||||
home = config.home.homeDirectory;
|
||||
in
|
||||
builtins.fromTOML ''
|
||||
[whitelist]
|
||||
prefix = [ "${home}/.dotfiles" ]
|
||||
[global]
|
||||
strict_env = true
|
||||
'';
|
||||
};
|
||||
}
|
||||
85
nix/homeModules/fish/aliasesAbbrs.nix
Normal file
85
nix/homeModules/fish/aliasesAbbrs.nix
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
pkgs,
|
||||
hostname,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.fish = {
|
||||
shellAbbrs = lib.mkMerge [
|
||||
{
|
||||
## 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 && $EDITOR flake.nix && prevd";
|
||||
nd = "nix develop -L -c fish";
|
||||
vp = "cd ~/.dotfiles/.config/nvim && $EDITOR init.lua && prevd";
|
||||
xp = "cd ~/.dotfiles/.config/xmonad && $EDITOR xmonad.hs && prevd";
|
||||
}
|
||||
|
||||
# TODO: move this out
|
||||
(lib.mkIf pkgs.stdenv.isLinux {
|
||||
ss = "sudo systemctl";
|
||||
se = "SUDO_EDITOR=(which nvim) sudoedit";
|
||||
ns = "sudo nixos-rebuild switch -L --flake ~/.dotfiles#${hostname}";
|
||||
hs = "home-manager switch -L --flake ~/.dotfiles#${hostname}";
|
||||
})
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isDarwin {
|
||||
ns = "darwin-rebuild switch -L --flake ~/.dotfiles#${hostname} --option sandbox false";
|
||||
ndd = "nix develop -L --option sandbox false -c true"; # run the develop once without sandbox when needed
|
||||
})
|
||||
];
|
||||
|
||||
shellAliases = lib.mkMerge [
|
||||
{
|
||||
rm = "rm -i"; # idiot protection
|
||||
tree = "tree -Cph";
|
||||
restow = "cd ~/.dotfiles/ && stow -D . && stow -S . && prevd";
|
||||
nix-shell = "nix-shell --run fish";
|
||||
",," = "nix shell -c";
|
||||
}
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isLinux {
|
||||
chmod = "chmod --preserve-root";
|
||||
chown = "chown --preserve-root";
|
||||
})
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isDarwin {
|
||||
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
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
11
nix/homeModules/fish/conf.d/bind.fish
Normal file
11
nix/homeModules/fish/conf.d/bind.fish
Normal 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
|
||||
100
nix/homeModules/fish/conf.d/colorscheme.fish
Normal file
100
nix/homeModules/fish/conf.d/colorscheme.fish
Normal 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 command’s 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
|
||||
6
nix/homeModules/fish/conf.d/interactiveShellInit.fish
Normal file
6
nix/homeModules/fish/conf.d/interactiveShellInit.fish
Normal 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
|
||||
14
nix/homeModules/fish/conf.d/locale.fish
Normal file
14
nix/homeModules/fish/conf.d/locale.fish
Normal 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
|
||||
4
nix/homeModules/fish/conf.d/shellInit.fish
Normal file
4
nix/homeModules/fish/conf.d/shellInit.fish
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# repo paths
|
||||
set REPOS_PATH ~/repos
|
||||
set UNIV_REPOS_PATH ~/univ-repos
|
||||
set PLAYGROUND_PATH ~/playground
|
||||
106
nix/homeModules/fish/default.nix
Normal file
106
nix/homeModules/fish/default.nix
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ./aliasesAbbrs.nix ];
|
||||
|
||||
programs.fish =
|
||||
let
|
||||
readConfig = n: builtins.readFile ./conf.d/${n}.fish;
|
||||
readConfigs = ns: builtins.concatStringsSep "\n" (map readConfig ns);
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
|
||||
shellInit = ''
|
||||
${readConfig "shellInit"}
|
||||
|
||||
# Just in case $PATH is broken, add them in an idempotent fashion
|
||||
fish_add_path --prepend --move /nix/var/nix/profiles/default/bin
|
||||
fish_add_path --prepend --move ${config.home.homeDirectory}/.local/.local/bin
|
||||
fish_add_path --prepend --move ${config.home.homeDirectory}/.dotfiles/.local/bin
|
||||
fish_add_path --prepend --move ${config.home.homeDirectory}/.nix-profile/bin
|
||||
fish_add_path --prepend --move /run/current-system/sw/bin
|
||||
fish_add_path --prepend --move /etc/profiles/per-user/${config.home.username}/bin # prioritize user path
|
||||
|
||||
# Make sure wrapper comes first
|
||||
# https://discourse.nixos.org/t/sudo-run-current-system-sw-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set-and-cannot-chdir-var-cron-bailing-out-var-cron-permission-denied/20463/2
|
||||
fish_add_path --prepend --move /run/wrappers/bin
|
||||
|
||||
${lib.strings.optionalString pkgs.stdenv.isDarwin ''
|
||||
# Add brew, but as fallback
|
||||
# Don't move it at all
|
||||
fish_add_path --path --append /opt/homebrew/bin; :
|
||||
''}
|
||||
'';
|
||||
|
||||
interactiveShellInit = readConfigs [
|
||||
"interactiveShellInit"
|
||||
"bind"
|
||||
"colorscheme"
|
||||
"locale"
|
||||
];
|
||||
|
||||
functions =
|
||||
let
|
||||
makeFishFunctions =
|
||||
ns:
|
||||
lib.trivial.pipe ns [
|
||||
(map (n: {
|
||||
name = n;
|
||||
value = builtins.readFile ./functions/${n}.fish;
|
||||
}))
|
||||
builtins.listToAttrs
|
||||
];
|
||||
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 = "v10.3";
|
||||
hash = "sha256-T8KYLA/r/gOKvAivKRoeqIwE2pINlxFQtZJHpOy9GMM=";
|
||||
};
|
||||
}
|
||||
{
|
||||
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";
|
||||
sha256 = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w=";
|
||||
rev = "1.1.0";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
8
nix/homeModules/fish/functions/,.fish
Normal file
8
nix/homeModules/fish/functions/,.fish
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
set ps
|
||||
for p in $argv
|
||||
set -a ps "nixpkgs#$p"
|
||||
end
|
||||
|
||||
set cmd "nix shell $ps"
|
||||
echo "Executing `$cmd`..."
|
||||
eval $cmd
|
||||
9
nix/homeModules/fish/functions/clone_to_repos.fish
Normal file
9
nix/homeModules/fish/functions/clone_to_repos.fish
Normal 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
|
||||
6
nix/homeModules/fish/functions/file_extension.fish
Normal file
6
nix/homeModules/fish/functions/file_extension.fish
Normal 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
|
||||
6
nix/homeModules/fish/functions/file_mantissa.fish
Normal file
6
nix/homeModules/fish/functions/file_mantissa.fish
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
if count $argv >/dev/null
|
||||
echo (basename $argv) | sed 's/\.[^.]*$//'
|
||||
else
|
||||
echo "Please supply a path"
|
||||
return 1
|
||||
end
|
||||
14
nix/homeModules/fish/functions/fish_command_not_found.fish
Normal file
14
nix/homeModules/fish/functions/fish_command_not_found.fish
Normal 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
|
||||
12
nix/homeModules/fish/functions/fish_greeting.fish
Normal file
12
nix/homeModules/fish/functions/fish_greeting.fish
Normal 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
|
||||
6
nix/homeModules/fish/functions/fish_remove_path.fish
Normal file
6
nix/homeModules/fish/functions/fish_remove_path.fish
Normal 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
|
||||
28
nix/homeModules/fish/functions/largest-objects-in-repo.fish
Normal file
28
nix/homeModules/fish/functions/largest-objects-in-repo.fish
Normal 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 ', '
|
||||
1
nix/homeModules/fish/functions/snakecase.fish
Normal file
1
nix/homeModules/fish/functions/snakecase.fish
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo $argv | sed -E 's/[^A-Za-z0-9_\n]+/_/g' | sed -E 's/__+/_/g' | tr '[:upper:]' '[:lower:]'
|
||||
1
nix/homeModules/fish/functions/timestamp.fish
Normal file
1
nix/homeModules/fish/functions/timestamp.fish
Normal file
|
|
@ -0,0 +1 @@
|
|||
date +%s
|
||||
21
nix/homeModules/fish/functions/tmux_attach.fish
Normal file
21
nix/homeModules/fish/functions/tmux_attach.fish
Normal 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
|
||||
18
nix/homeModules/fish/functions/tmux_home.fish
Normal file
18
nix/homeModules/fish/functions/tmux_home.fish
Normal 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
|
||||
19
nix/homeModules/fish/functions/tmux_last.fish
Normal file
19
nix/homeModules/fish/functions/tmux_last.fish
Normal 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
|
||||
48
nix/homeModules/fish/functions/tmux_sessionizer.fish
Normal file
48
nix/homeModules/fish/functions/tmux_sessionizer.fish
Normal 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
|
||||
6
nix/homeModules/fish/functions/update_dotfiles.fish
Normal file
6
nix/homeModules/fish/functions/update_dotfiles.fish
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
cd ~/.dotfiles/
|
||||
git reset --hard
|
||||
git pull --set-upstream origin main
|
||||
git submodule update --init
|
||||
prevd
|
||||
restow
|
||||
16
nix/homeModules/fzf/default.nix
Normal file
16
nix/homeModules/fzf/default.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
}
|
||||
64
nix/homeModules/git/default.nix
Normal file
64
nix/homeModules/git/default.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
# 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"
|
||||
".DS_Store"
|
||||
".direnv/"
|
||||
"**/result"
|
||||
".pre-commit-config.yaml"
|
||||
".config/nvim/spell/"
|
||||
".local/bin/"
|
||||
];
|
||||
};
|
||||
|
||||
# identity
|
||||
programs.git = {
|
||||
userEmail = "leana.jiang+git@icloud.com";
|
||||
userName = "Léana 江";
|
||||
signing = {
|
||||
key = "0x4E887A4CA9714ADA";
|
||||
signByDefault = lib.mkDefault false;
|
||||
};
|
||||
};
|
||||
|
||||
programs.git.includes = [
|
||||
# university identity
|
||||
{
|
||||
condition = "gitdir:~/univ-repos/";
|
||||
contents = {
|
||||
init.defaultBranch = "main";
|
||||
user = {
|
||||
name = "Léana CHIANG";
|
||||
email = "leana.chiang@etudiant.univ-rennes1.fr";
|
||||
signingKey = "0x32035DB97E777EEB";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
12
nix/homeModules/gpg/default.nix
Normal file
12
nix/homeModules/gpg/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
programs.gpg.enable = true;
|
||||
|
||||
services.gpg-agent = lib.mkIf pkgs.stdenv.isLinux {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
defaultCacheTtl = 1209600;
|
||||
|
||||
pinentryPackage = pkgs.pinentry-tty;
|
||||
};
|
||||
}
|
||||
45
nix/homeModules/kitty/default.nix
Normal file
45
nix/homeModules/kitty/default.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.kitty = lib.mkIf config.programs.kitty.enable {
|
||||
font = {
|
||||
name = "HiosevkaNFM";
|
||||
size = 17;
|
||||
};
|
||||
settings = {
|
||||
foreground = "#000000";
|
||||
background = "#ffffff";
|
||||
confirm_os_window_close = 0;
|
||||
text_composition_strategy = "1.55 0";
|
||||
shell = "${pkgs.fish}/bin/fish -c tmux_home";
|
||||
};
|
||||
extraConfig = ''
|
||||
background #f8f8f8
|
||||
foreground #2a2b33
|
||||
cursor #bbbbbb
|
||||
selection_background #ececec
|
||||
color0 #000000
|
||||
color8 #000000
|
||||
color1 #ca1243
|
||||
color9 #ca1243
|
||||
color2 #50a14f
|
||||
color10 #50a14f
|
||||
color3 #e5bf6d
|
||||
color11 #e5bf6d
|
||||
color4 #4078f2
|
||||
color12 #4078f2
|
||||
color5 #950095
|
||||
color13 #a00095
|
||||
color6 #0184bc
|
||||
color14 #0184bc
|
||||
color7 #bbbbbb
|
||||
color15 #ffffff
|
||||
selection_foreground #f8f8f8
|
||||
'';
|
||||
shellIntegration.enableFishIntegration = true;
|
||||
};
|
||||
}
|
||||
53
nix/homeModules/neovim/default.nix
Normal file
53
nix/homeModules/neovim/default.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.extra.lang-servers.enable = lib.mkOption { default = false; };
|
||||
|
||||
config = {
|
||||
programs.neovim = {
|
||||
package = pkgs.neovim-pin.neovim-unwrapped;
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
extraPackages = lib.mkMerge [
|
||||
[
|
||||
pkgs.lua-language-server
|
||||
pkgs.stylua
|
||||
pkgs.nodePackages.bash-language-server
|
||||
pkgs.shellcheck
|
||||
pkgs.shfmt
|
||||
pkgs.nil
|
||||
pkgs.yaml-language-server
|
||||
]
|
||||
(lib.mkIf config.extra.lang-servers.enable [
|
||||
pkgs.nodePackages.vim-language-server
|
||||
pkgs.nodePackages.pyright
|
||||
pkgs.vscode-langservers-extracted # HTML/CSS/JSON/ESLint
|
||||
pkgs.marksman
|
||||
pkgs.taplo
|
||||
pkgs.lemminx
|
||||
pkgs.texlab
|
||||
])
|
||||
];
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
86
nix/homeModules/packages/default.nix
Normal file
86
nix/homeModules/packages/default.nix
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) myPkgs;
|
||||
in
|
||||
|
||||
{
|
||||
options.extra = {
|
||||
utilities.enable = lib.mkOption { default = false; };
|
||||
workflow.enable = lib.mkOption { default = false; };
|
||||
university.enable = lib.mkOption { default = false; };
|
||||
};
|
||||
|
||||
config = {
|
||||
programs.home-manager.enable = true;
|
||||
home = {
|
||||
username = lib.mkDefault "leana";
|
||||
homeDirectory = lib.mkDefault (
|
||||
lib.mkMerge [
|
||||
(lib.mkIf pkgs.stdenv.isLinux "/home/leana")
|
||||
(lib.mkIf pkgs.stdenv.isDarwin "/Users/leana")
|
||||
]
|
||||
);
|
||||
stateVersion = "24.05";
|
||||
};
|
||||
|
||||
programs.ripgrep.enable = true;
|
||||
home.packages = lib.mkMerge [
|
||||
[
|
||||
# shell and script dependencies
|
||||
pkgs.figlet
|
||||
pkgs.gnused
|
||||
pkgs.stow
|
||||
pkgs.fd
|
||||
pkgs.vivid
|
||||
pkgs.rsync
|
||||
|
||||
# nix
|
||||
pkgs.nixfmt-rfc-style
|
||||
|
||||
# utils
|
||||
pkgs.tree
|
||||
pkgs.tldr
|
||||
pkgs.parallel
|
||||
pkgs.findutils # xargs and more
|
||||
pkgs.du-dust
|
||||
]
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isDarwin [
|
||||
# coreutils
|
||||
pkgs.uutils-coreutils-noprefix
|
||||
])
|
||||
|
||||
(lib.mkIf config.extra.utilities.enable [
|
||||
pkgs.jq
|
||||
pkgs.hyperfine
|
||||
pkgs.watchexec
|
||||
pkgs.onefetch
|
||||
pkgs.ghostscript
|
||||
myPkgs.tokei
|
||||
pkgs.gnumake
|
||||
pkgs.just
|
||||
pkgs.nurl
|
||||
pkgs.tea
|
||||
pkgs.agenix
|
||||
])
|
||||
|
||||
(lib.mkIf config.extra.workflow.enable [
|
||||
pkgs.act
|
||||
pkgs.forgejo-actions-runner
|
||||
])
|
||||
|
||||
(lib.mkIf config.extra.university.enable [
|
||||
pkgs.rars
|
||||
myPkgs.logisim-evolution
|
||||
myPkgs.necrolib
|
||||
myPkgs.why3
|
||||
])
|
||||
];
|
||||
};
|
||||
}
|
||||
26
nix/homeModules/password-store/default.nix
Normal file
26
nix/homeModules/password-store/default.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
pass_enabled = config.programs.password-store.enable;
|
||||
|
||||
pass_cfg = {
|
||||
package = pkgs.pass.withExtensions (exts: [
|
||||
exts.pass-otp
|
||||
exts.pass-import
|
||||
]);
|
||||
settings = {
|
||||
PASSWORD_STORE_DIR = "${config.home.homeDirectory}/repos/leana/vault";
|
||||
};
|
||||
};
|
||||
extra_programs = [ pkgs.diceware ];
|
||||
in
|
||||
|
||||
{
|
||||
home.packages = lib.mkIf pass_enabled extra_programs;
|
||||
programs.password-store = lib.mkIf pass_enabled pass_cfg;
|
||||
}
|
||||
7
nix/homeModules/starship/default.nix
Normal file
7
nix/homeModules/starship/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
settings = fromTOML (builtins.readFile ./starship.toml);
|
||||
};
|
||||
}
|
||||
92
nix/homeModules/starship/starship.toml
Normal file
92
nix/homeModules/starship/starship.toml
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
"$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]
|
||||
# https://github.com/starship/starship/blob/073e16b4926009565c06897aabda7f807c63c5a0/src/modules/nix_shell.rs#L66-L70
|
||||
# apparently `$name` and `$unknown_msg` are mutually exclusive
|
||||
format = '[ \($state( $name)\)]($style) '
|
||||
unknown_msg = "nix"
|
||||
heuristic = true
|
||||
12
nix/homeModules/tmux/default.nix
Normal file
12
nix/homeModules/tmux/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ 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;
|
||||
};
|
||||
}
|
||||
128
nix/homeModules/tmux/tmux.conf
Normal file
128
nix/homeModules/tmux/tmux.conf
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
###########
|
||||
# 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-interval 1
|
||||
set -g status-position top
|
||||
set -g status-justify left
|
||||
set -g status-style "fg=#{@FG},bg=#{@VISUAL}"
|
||||
set -g status-left ""
|
||||
set -g status-right-style "fg=#{@FG}"
|
||||
set -g status-right "#(date) · #(basename #S)@#(uname -n) "
|
||||
set -g status-right-length "70"
|
||||
set -g window-status-activity-style "fg=#{@FG},bold,blink"
|
||||
set -g window-status-bell-style "fg=#{@FG},bold,blink"
|
||||
|
||||
# window name
|
||||
set -g window-status-style "fg=#{@GREY},bg=#{@VISUAL}"
|
||||
set -g window-status-format " #{pane_current_command}"
|
||||
set -g window-status-current-style "fg=#{@FG},bold,bg=#{@VISUAL}"
|
||||
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/_/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 run-shell "tmux neww 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'
|
||||
# }
|
||||
41
nix/homeModules/user-nixconf/default.nix
Normal file
41
nix/homeModules/user-nixconf/default.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# generates user's substituter's config
|
||||
# should be used with home-manager
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
nix = {
|
||||
package = lib.mkDefault pkgs.nixVersions.nix_2_21;
|
||||
settings = {
|
||||
allow-import-from-derivation = "true";
|
||||
/*
|
||||
substituters can only be used by users that are trusted by nix -> nix trusts the user to do it right
|
||||
trusted-substituters can be used by any user -> nix trusts everything the substituter provides
|
||||
|
||||
"In addition, each store path should be trusted as described in trusted-public-keys"
|
||||
-> keys for everything
|
||||
*/
|
||||
extra-substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://leana8959.cachix.org"
|
||||
];
|
||||
extra-trusted-substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://leana8959.cachix.org"
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"leana8959.cachix.org-1:CxQSAp8lcgMv8Me459of0jdXRW2tcyeYRKTiiUq8z0M="
|
||||
];
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
};
|
||||
|
||||
registry.flakies = {
|
||||
from.id = "flakies";
|
||||
from.type = "indirect";
|
||||
to.type = "git";
|
||||
to.url = "https://git.earth2077.fr/leana/flakies";
|
||||
};
|
||||
};
|
||||
}
|
||||
34
nix/homeModules/vim/default.nix
Normal file
34
nix/homeModules/vim/default.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.vim =
|
||||
let
|
||||
paramount = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "paramount";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "owickstrom";
|
||||
repo = "vim-colors-paramount";
|
||||
rev = "a5601d36fb6932e8d1a6f8b37b179a99b1456798";
|
||||
hash = "sha256-j9nMjKYK7bqrGHprYp0ddLEWs1CNMudxXD13sOROVmY=";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
extraConfig = builtins.readFile ./vimrc;
|
||||
plugins =
|
||||
let
|
||||
vpkgs = pkgs.vimPlugins;
|
||||
in
|
||||
[
|
||||
vpkgs.vim-sleuth
|
||||
vpkgs.vim-surround
|
||||
vpkgs.vim-fugitive
|
||||
vpkgs.vim-commentary
|
||||
vpkgs.undotree
|
||||
vpkgs.tabular
|
||||
vpkgs.vim-wakatime
|
||||
vpkgs.vim-caddyfile
|
||||
paramount
|
||||
];
|
||||
};
|
||||
}
|
||||
105
nix/homeModules/vim/vimrc
Normal file
105
nix/homeModules/vim/vimrc
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
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 "
|
||||
"""""""""""""""
|
||||
colorscheme paramount
|
||||
Loading…
Add table
Add a link
Reference in a new issue