2
2
mirror of https://git.feal.no/felixalb/nixos-config.git synced 2024-12-21 19:57:30 +01:00

Worf: various updates: nvim-telescope, yabai, sketchybar, builders

This commit is contained in:
Felix Albrigtsen 2023-12-07 10:22:35 +01:00 committed by Felix Albrigtsen
parent 3030637f01
commit 99e61c719f
8 changed files with 433 additions and 12 deletions

View File

@ -1,7 +1,6 @@
{ config, lib, pkgs, inputs, values, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
@ -43,13 +42,13 @@
environment.systemPackages = with pkgs; [
bat
bottom
unstable.eza
git
gnugrep
gnutar
ripgrep
rsync
tree
unstable.eza
wget
];

View File

@ -0,0 +1,14 @@
{ lib, stdenvNoCC, fetchurl }:
stdenvNoCC.mkDerivation rec {
name = "sketchybar-app-font";
version = "1.0.20";
src = fetchurl {
url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/sketchybar-app-font.ttf";
hash = "sha256-pf3SSxzlNIdbXXHfRauFCnrVUMOd5J9sSUE9MsfWrwo=";
};
phases = [ "installPhase" ];
installPhase = ''
install -Dm644 $src $out/share/fonts/sketchybar-app-font/Regular.ttf
'';
}

334
home/alacritty.nix Normal file
View File

@ -0,0 +1,334 @@
{ pkgs, lib, inputs, config, ...}:
{
programs.alacritty = {
enable = true;
settings = {
env = {
TERM = "xterm-256color";
};
window = {
padding = {
x = 4;
y = 4;
};
decorations = "none"; # full/none/transparent/buttonless
# Transparency:
# opacity = 0.95;
};
scrolling = {
history = 9999;
multiplier = 3;
};
# Font configuration (changes require restart)
font = {
normal = {
family = "Hack Nerd Font Mono";
style = "Regular";
};
bold = {
family = "Hack Nerd Font Mono";
style = "Bold";
};
italic = {
family = "Hack Nerd Font Mono";
style = "Italic";
};
size = 14;
};
draw_bold_text_with_bright_colors = true;
colors = {
# # Tomorrow Night Bright
# primary = {
# background = "0x141414";
# foreground = "0xeaeaea";
# };
# cursor = {
# text = "0x000000";
# cursor = "0xffffff";
# };
# normal = {
# black = "0x000000";
# red = "0xd54e53";
# green = "0x82de37";
# yellow = "0xe6c547";
# blue = "0x7aa6da";
# magenta = "0xc397d8";
# cyan = "0x70c0ba";
# white = "0xffffff";
# };
# bright = {
# black = "0x666666";
# red = "0xff3334";
# green = "0x8bd45d";
# yellow = "0xe7c547";
# blue = "0x7aa6da";
# magenta = "0xb77ee0";
# cyan = "0x54ced6";
# white = "0xffffff";
# };
# Nord:
primary = {
background = "0x2e3440";
foreground = "0xd8dee9";
dim_foreground = "0xa5abb6";
};
cursor = {
text = "0x2e3440";
cursor = "0xd8dee9";
};
vi_mode_cursor = {
text = "0x2e3440";
cursor = "0xd8dee9";
};
selection = {
text = "CellForeground";
background = "0x4c566a";
};
normal = {
black = "0x3b4252";
red = "0xbf616a";
green = "0xa3be8c";
yellow = "0xebcb8b";
blue = "0x81a1c1";
magenta = "0xb48ead";
cyan = "0x88c0d0";
white = "0xe5e9f0";
};
bright = {
black = "0x4c566a";
red = "0xbf616a";
green = "0xa3be8c";
yellow = "0xebcb8b";
blue = "0x81a1c1";
magenta = "0xb48ead";
cyan = "0x8fbcbb";
white = "0xeceff4";
};
dim = {
black = "0x373e4d";
red = "0x94545d";
green = "0x809575";
yellow = "0xb29e75";
blue = "0x68809a";
magenta = "0x8c738c";
cyan = "0x6d96a5";
white = "0xaeb3bb";
};
# Indexed Colors
#
# The indexed colors include all colors from 16 to 256.
# When these are not set, they're filled with sensible defaults.
#
# Example:
# `- { index: 16, color: '0xff00ff' }`
#
# indexed_colors: []
};
visual_bell = {
animation = "EaseOutExpo";
color = "0xffffff";
duration = 200;
};
# Key bindings
#
# Key bindings are specified as a list of objects. Each binding will specify a
# key and modifiers required to trigger it, terminal modes where the binding is
# applicable, and what should be done when the key binding fires. It can either
# send a byte sequence to the running application (`chars`), execute a
# predefined action (`action`) or fork and execute a specified command plus
# arguments (`command`).
#
# Bindings are always filled by default, but will be replaced when a new binding
# with the same triggers is defined. To unset a default binding, it can be
# mapped to the `None` action.
#
# Example:
# `- { key: V, mods: Control|Shift, action: Paste }`
#
# Available fields:
# - key
# - mods (optional)
# - chars | action | command (exactly one required)
# - mode (optional)
#
# Values for `key`:
# - `A` -> `Z`
# - `F1` -> `F12`
# - `Key1` -> `Key0`
#
# A full list with available key codes can be found here:
# https://docs.rs/glutin/*/glutin/enum.VirtualKeyCode.html#variants
#
# Instead of using the name of the keys, the `key` field also supports using
# the scancode of the desired key. Scancodes have to be specified as a
# decimal number.
# This command will allow you to display the hex scancodes for certain keys:
# `showkey --scancodes`
#
# Values for `mods`:
# - Command
# - Control
# - Option
# - Super
# - Shift
# - Alt
#
# Multiple `mods` can be combined using `|` like this: `mods: Control|Shift`.
# Whitespace and capitalization is relevant and must match the example.
#
# Values for `chars`:
# The `chars` field writes the specified string to the terminal. This makes
# it possible to pass escape sequences.
# To find escape codes for bindings like `PageUp` ("\x1b[5~"), you can run
# the command `showkey -a` outside of tmux.
# Note that applications use terminfo to map escape sequences back to
# keys. It is therefore required to update the terminfo when
# changing an escape sequence.
#
# Values for `action`:
# - Paste
# - PasteSelection
# - Copy
# - IncreaseFontSize
# - DecreaseFontSize
# - ResetFontSize
# - ScrollPageUp
# - ScrollPageDown
# - ScrollLineUp
# - ScrollLineDown
# - ScrollToTop
# - ScrollToBottom
# - ClearHistory
# - Hide
# - Quit
# - ClearLogNotice
# - SpawnNewInstance
# - ToggleFullscreen
# - None
#
# Values for `action` (macOS only):
# - ToggleSimpleFullscreen: Enters fullscreen without occupying another space
#
# Values for `command`:
# The `command` field must be a map containing a `program` string and
# an `args` array of command line parameter strings.
#
# Example:
# `command: { program: "alacritty", args: ["-e", "vttest"] }`
#
# Values for `mode`:
# - ~AppCursor
# - AppCursor
# - ~AppKeypad
# - AppKeypad
#
# key_bindings:
# - { key: V, mods: Alt, action: Paste }
# - { key: C, mods: Alt, action: Copy }
# - { key: Q, mods: Alt, action: Quit }
# - { key: N, mods: Alt, action: SpawnNewInstance }
# - { key: Return, mods: Alt, action: ToggleFullscreen }
# - { key: Home, chars: "\x1bOH", mode: AppCursor }
# - { key: Home, chars: "\x1b[H", mode: ~AppCursor }
# - { key: End, chars: "\x1bOF", mode: AppCursor }
# - { key: End, chars: "\x1b[F", mode: ~AppCursor }
# - { key: Equals, mods: Alt, action: IncreaseFontSize }
# - { key: Minus, mods: Alt, action: DecreaseFontSize }
# - { key: Minus, mods: Alt|Shift, action: ResetFontSize }
# - { key: PageUp, mods: Shift, chars: "\x1b[5;2~" }
# - { key: PageUp, mods: Control, chars: "\x1b[5;5~" }
# - { key: PageUp, chars: "\x1b[5~" }
# - { key: PageDown, mods: Shift, chars: "\x1b[6;2~" }
# - { key: PageDown, mods: Control, chars: "\x1b[6;5~" }
# - { key: PageDown, chars: "\x1b[6~" }
# - { key: Left, mods: Shift, chars: "\x1b[1;2D" }
# - { key: Left, mods: Control, chars: "\x1b[1;5D" }
# - { key: Left, mods: Alt, chars: "\x1b[1;3D" }
# - { key: Left, chars: "\x1b[D", mode: ~AppCursor }
# - { key: Left, chars: "\x1bOD", mode: AppCursor }
# - { key: Right, mods: Shift, chars: "\x1b[1;2C" }
# - { key: Right, mods: Control, chars: "\x1b[1;5C" }
# - { key: Right, mods: Alt, chars: "\x1b[1;3C" }
# - { key: Right, chars: "\x1b[C", mode: ~AppCursor }
# - { key: Right, chars: "\x1bOC", mode: AppCursor }
# - { key: Up, mods: Shift, chars: "\x1b[1;2A" }
# - { key: Up, mods: Control, chars: "\x1b[1;5A" }
# - { key: Up, mods: Alt, chars: "\x1b[1;3A" }
# - { key: Up, chars: "\x1b[A", mode: ~AppCursor }
# - { key: Up, chars: "\x1bOA", mode: AppCursor }
# - { key: Down, mods: Shift, chars: "\x1b[1;2B" }
# - { key: Down, mods: Control, chars: "\x1b[1;5B" }
# - { key: Down, mods: Alt, chars: "\x1b[1;3B" }
# - { key: Down, chars: "\x1b[B", mode: ~AppCursor }
# - { key: Down, chars: "\x1bOB", mode: AppCursor }
# - { key: Tab, mods: Shift, chars: "\x1b[Z" }
# - { key: F1, chars: "\x1bOP" }
# - { key: F2, chars: "\x1bOQ" }
# - { key: F3, chars: "\x1bOR" }
# - { key: F4, chars: "\x1bOS" }
# - { key: F5, chars: "\x1b[15~" }
# - { key: F6, chars: "\x1b[17~" }
# - { key: F7, chars: "\x1b[18~" }
# - { key: F8, chars: "\x1b[19~" }
# - { key: F9, chars: "\x1b[20~" }
# - { key: F10, chars: "\x1b[21~" }
# - { key: F11, chars: "\x1b[23~" }
# - { key: F12, chars: "\x1b[24~" }
# - { key: Back, chars: "\x7f" }
# - { key: Back, mods: Alt, chars: "\x1b\x7f" }
# - { key: Insert, chars: "\x1b[2~" }
# - { key: Delete, chars: "\x1b[3~" }
mouse = {
double_click = { threshold = 300; };
triple_click = { threshold = 300; };
hide_when_typing = false;
};
selection = {
semantic_escape_chars = ",`|:\"' ()[]{}<>";
save_to_clipboard = false;
};
mouse_bindings = [
{ mouse = "Middle"; action = "PasteSelection"; }
];
cursor = {
style = "Block";
blinking = true;
unfocused_hollow = true;
};
dynamic_title = true;
};
};
}

View File

@ -16,6 +16,7 @@
nerdtree
nerdtree-git-plugin
vim-devicons
telescope-nvim
nvim-lspconfig
copilot-vim
@ -96,7 +97,17 @@
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" List and switch buffers on Ctrl+k
nnoremap <C-k> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>
" nnoremap <C-k> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>
nnoremap <silent> <C-k> !echo "Did you mean C-a?"<CR>
" Telescope-settings
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
nnoremap <C-a> <cmd>Telescope buffers<cr>
nnoremap <C-s> <cmd>Telescope find_files<cr>
nnoremap <C-g> <cmd>Telescope live_grep<cr>
" Show trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red

View File

@ -21,10 +21,10 @@
"terminal"
"editor"
"history"
"directory"
# "directory"
"spectrum"
"utility"
"completion"
# "utility"
# "completion"
"git"
"autosuggestions"
"syntax-highlighting"

View File

@ -55,9 +55,10 @@
systemPackages = with pkgs; [
findutils
gnugrep
jq
ripgrep
wget
sshfs
wget
];
variables = {
@ -82,6 +83,7 @@
font-awesome
fira-code
hack-font
(nerdfonts.override {
fonts = [
"Hack"

View File

@ -6,10 +6,11 @@
}: {
imports = [
./../../home/base.nix
./../../home/alacritty.nix
];
home.packages = with pkgs; [
alacritty
# alacritty
emacs
iterm2
spotify

View File

@ -1,23 +1,35 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.yabai;
sketchybar-app-font = pkgs.callPackage ./../../common/sketchybar-app-font.nix {};
in {
services.yabai = {
enable = true;
package = pkgs.unstable.yabai;
enableScriptingAddition = true;
config = {
layout = "bsp";
debug_output = "on";
focus_follows_mouse = "autoraise";
mouse_follows_focus = "off";
window_placement = "second_child";
window_opacity = "off";
window_border = "on";
window_border_width = 1;
window_border_blur = "off";
normal_window_border_color = "0xff404066";
active_window_border_color = "0xffff2020";
window_border_radius = 0;
# top_padding = 10;
# bottom_padding = 10;
# left_padding = 10;
# right_padding = 10;
window_gap = 10;
window_gap = 0;
external_bar = "all:40:0";
};
};
@ -27,6 +39,7 @@ in {
mod = "alt";
mod2 = "alt + ctrl";
mod3 = "alt + shift";
mod4 = "alt + cmd";
in ''
# Move window focus
${mod} - j : yabai -m window --focus south
@ -59,11 +72,58 @@ in {
${mod2} - 6 : yabai -m window --space 6
${mod2} - 7 : yabai -m window --space 7
# Misc
# Switch spaces
ctrl - left : yabai -m space --focus prev
ctrl - right : yabai -m space --focus next
ctrl - 1 : yabai -m space --focus 1
ctrl - 2 : yabai -m space --focus 2
ctrl - 3 : yabai -m space --focus 3
ctrl - 4 : yabai -m space --focus 4
ctrl - 5 : yabai -m space --focus 5
ctrl - 6 : yabai -m space --focus 6
ctrl - 7 : yabai -m space --focus 7
# Resize windows
${mod2} - j : yabai -m window --resize bottom:0:20
${mod2} - k : yabai -m window --resize bottom:0:-20
${mod2} - h : yabai -m window --resize right:-20:0
${mod2} - l : yabai -m window --resize right:20:0
${mod2} - down : yabai -m window --resize bottom:0:20
${mod2} - up : yabai -m window --resize bottom:0:-20
${mod2} - left : yabai -m window --resize right:-20:0
${mod2} - right : yabai -m window --resize right:20:0
# Move windows to different displays
${mod2} + cmd - 1 : yabai -m window --display 1
${mod2} + cmd - 2 : yabai -m window --display 2
${mod2} + cmd - 3 : yabai -m window --display 3
# Fullscreen
${mod2} - f : yabai -m window --toggle zoom-fullscreen
${mod2} + shift - f : yabai -m window --toggle native-fullscreen
# Mirror layout
${mod2} - m : yabai -m space --mirror y-axis
# Misc.
${mod2} - b : yabai -m space --balance
${mod3} - space : yabai -m window --toggle float --grid 4:4:1:1:2:2
${mod2} - space : yabai -m window --toggle float --grid 4:4:1:1:2:2
${mod2} - return : yabai -m window --toggle split
# Launch terminal
cmd - return : open -n -a ${pkgs.alacritty}/Applications/Alacritty.app
'';
};
services.sketchybar = {
enable = true;
package = pkgs.unstable.sketchybar;
# The config is handled outside of nix, and is placed in ~/.config/sketchybar
};
fonts.fonts = [
sketchybar-app-font
];
}