home manager!

also a bunch of other stuff
This commit is contained in:
LavaDesu 2021-05-20 14:02:49 +07:00
parent beee908e58
commit bb70530786
Signed by: cilly
GPG key ID: 6500251E087653C9
17 changed files with 1073 additions and 15 deletions

View file

@ -9,6 +9,7 @@
"ssh/ssh_host_ed25519_key".source = "/mnt/bcachefs/ssh_host_ed25519_key";
"ssh/ssh_host_ed25519_key.pub".source = "/mnt/bcachefs/ssh_host_ed25519_key.pub";
};
environment.pathsToLink = [ "/share/zsh" ];
users.mutableUsers = false;
imports = [
@ -19,6 +20,8 @@
./networking.nix
./packages.nix
./security.nix
./rin
];
nix = {
package = pkgs.nixUnstable;

View file

@ -1,18 +1,28 @@
{ config, pkgs, ...}: {
environment.systemPackages = with pkgs; [
git libarchive lf msr-tools neofetch neovim nodejs rsync wget
gnupg
glxinfo htop light ncdu xorg.xgamma
alacritty discord-canary element-desktop firefox gnome3.nautilus pavucontrol tor-browser-bundle-bin
appimage-run osu-lazer wine-osu (winetricks.override { wine = wine-osu; })
git
gparted
htop
libarchive
lf
msr-tools
ncdu
neovim
rsync
wget
gnome3.nautilus
(pkgs.writeShellScriptBin "nix-flakes" ''
exec ${pkgs.nixUnstable}/bin/nix --experimental-features "nix-command flakes" "$@"
'')
];
hardware.opentabletdriver.enable = true;
environment.variables.EDITOR = "nvim";
programs.light.enable = true;
hardware.opentabletdriver.enable = true;
programs.steam.enable = true;
services.dbus.packages = [ pkgs.gnome3.dconf ];
services.gnome.sushi.enable = true;
services.ipfs.enable = true;
}

View file

@ -0,0 +1,33 @@
{ config, ... }: {
programs.alacritty = {
enable = true;
settings = {
scrolling = {
history = 10000;
multiplier = 3;
};
font = {
normal = {
family = "CascadiaCode";
style = "Regular";
};
size = 8.6;
};
window = {
dynamic_title = true;
padding = {
x = 5;
y = 0;
};
};
mouse = {
url.launcher.program = "xdg-open";
modifiers = "Control";
};
background_opacity = 0.8;
draw_bold_text_with_bright_colors = true;
live_config_reload = true;
};
};
}

View file

@ -0,0 +1,7 @@
{ config, pkgs, ... }: {
users.users.rin = {
isNormalUser = true;
extraGroups = [ "audio" "video" "wheel" ];
shell = pkgs.zsh;
};
}

68
cfg/winter/rin/dunst.nix Normal file
View file

@ -0,0 +1,68 @@
# TODO: i've literally never configured dunst ever since i first installed it (the rc was copypasted from somewhere i forgot im sorry), should play around with it later
{ config, ... }: {
services.dunst = {
enable = true;
settings = {
global = {
monitor = 0;
follow = "mouse";
#geometry = "250x50-24+24";
geometry = "600x50-24+24";
indicate_hidden = true;
shrink = true;
separator_height = 0;
padding = 16;
horizontal_padding = 24;
frame_width = 2;
sort = false;
idle_threshold = 120;
font = "Open Sans 8";
line_height = 4;
markup = "full";
format = "<b>%s</b>\\n%b";
alignment = "left";
show_age_threshold = 60;
word_wrap = true;
ignore_newline = false;
stack_duplicates = false;
hide_duplicate_count = true;
show_indicators = false;
icon_position = "left";
max_icon_size = 32;
sticky_history = true;
history_length = 20;
browser = "/run/current-system/sw/bin/firefox -new-tab";
always_run_script = true;
title = "Dunst";
class = "Dunst";
corner_radius = 5;
};
shortcuts = {
close = "ctrl+space";
close_all = "ctrl+shift+space";
history = "ctrl+grave";
context = "ctrl+shift+period";
};
urgency_low = {
background = "#2f343f";
foreground = "#d8dee8";
timeout = 2;
};
urgency_normal = {
background = "#2f343f";
foreground = "#d8dee8";
timeout = 4;
};
urgency_critical = {
background = "#2f343f";
foreground = "#d8dee8";
frame_color = "#bf616a";
timeout = 0;
};
};
};
}

18
cfg/winter/rin/gtk.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, pkgs, ... }: {
gtk = {
enable = true;
font = {
package = pkgs.open-sans;
name = "Open Sans";
size = 11;
};
iconTheme = {
package = pkgs.yaru-theme;
name = "Yaru";
};
theme = {
name = "Adapta-Nokto-Eta";
package = pkgs.adapta-gtk-theme;
};
};
}

64
cfg/winter/rin/home.nix Normal file
View file

@ -0,0 +1,64 @@
{ config, pkgs, ... }: rec {
home = {
username = "rin";
homeDirectory = "/home/rin";
stateVersion = "21.05";
packages = with pkgs; [
appimage-run
discord-canary
element-desktop
firefox
gimp
glxinfo
gnupg
lf
neofetch
nodejs
pavucontrol
osu-lazer
cargo rustc clippy cmake gcc gnumake pkg-config
tor-browser-bundle-bin
wine-osu
(winetricks.override { wine = wine-osu; })
xorg.xgamma
];
};
imports = [
./gtk.nix
./alacritty.nix
./neovim.nix
./rofi.nix
./zsh.nix
./dunst.nix
./picom.nix
./polybar.nix
./i3.nix
];
xdg = {
enable = true;
mime.enable = true;
mimeApps.enable = true;
};
programs = {
feh.enable = true;
git = {
enable = true;
userName = "LavaDesu";
userEmail = "me@lava.moe";
signing = {
key = "059F098EBF0E9A13E10A46BF6500251E087653C9";
signByDefault = true;
};
};
password-store = {
enable = true;
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
};
};
}

234
cfg/winter/rin/i3.nix Normal file
View file

@ -0,0 +1,234 @@
{ config, pkgs, ... }:
let
super = "Mod4";
alt = "Mod1";
mkGapsMode = mode: {
"plus" = "gaps ${mode} current plus 5";
"minus" = "gaps ${mode} current minus 5";
"0" = "gaps ${mode} current set 0";
"Shift+plus" = "gaps ${mode} all plus 5";
"Shift+minus" = "gaps ${mode} all minus 5";
"Shift+0" = "gaps ${mode} all set 0";
"Return" = "mode gapsMode";
"Escape" = "mode default";
};
genGapsModes = modes: builtins.listToAttrs (builtins.map (mode: {
name = mode;
value = mkGapsMode mode;
}) modes);
genColors = states: builtins.listToAttrs (builtins.map (state: {
name = state;
value = {
background = "#2f343f";
border = "#2f343f";
childBorder = "#2f343f";
indicator = "#2f343f";
text = "#d8dee8";
};
}) states);
in rec {
home.file.".xinitrc".source = ./scripts/xinitrc;
xsession.enable = true;
xsession.windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
config = {
startup = [
{
# HACK: what is this lol
command = "systemctl --user restart polybar";
always = true;
notification = false;
}
{
command = "feh --bg-fill /home/rin/Pictures/Wallpapers/current";
always = true;
notification = false;
}
];
fonts = {
names = [
"Open Sans"
"HanaMinA"
"HanaMinB"
];
style = "Regular";
size = 8.0;
};
floating = {
titlebar = false;
modifier = super;
};
window.border = 0;
bars = [];
gaps = {
smartGaps = true;
inner = 5;
};
colors = genColors [
"focused"
"focusedInactive"
"unfocused"
"urgent"
"placeholder"
] // { background = "#2f343f"; };
#colors.focused.background = "#1d242f";
modifier = super;
keybindings = {
# Rofi (App launcher)
"${super}+Return" = "exec rofi -lines 12 -padding 18 -width 60 -location 0 -show drun -sidebar-mode -columns 3 -font 'Noto Sans 8'";
# Printscreen
"Print" = "exec maim -us | tee ~/Pictures/Screenshots/$(date +%s)c.png | xclip -selection clipboard -t image/png";
"Shift+Print" = "exec maim -u | tee ~/Pictures/Screenshots/$(date +%s).png | xclip -selection clipboard -t image/png";
# Quick-kill picom
"${super}+p" = "exec systemctl --user stop picom";
"${super}+Shift+p" = "exec systemctl --user restart picom";
# Volume
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume 0 +5%";
"XF86AudioLowerVolume" = "exec pactl set-sink-volume 0 -5%";
"XF86AudioMute" = "exec pactl set-sink-volume 0 toggle";
# Brightness
"XF86MonBrightnessUp" = "exec light -A 10";
"XF86MonBrightnessDown" = "exec light -U 10";
"Shift+XF86MonBrightnessUp" = "exec light -A 1";
"Shift+XF86MonBrightnessDown" = "exec light -U 1";
"Ctrl+XF86MonBrightnessUp" = "exec xgamma -gamma 1.3";
"Ctrl+XF86MonBrightnessDown" = "exec xgamma -gamma 1";
# Music control
# "XF86AudioNext" = "exec mpc next";
# "XF86AudioPrev" = "exec mpc prev";
# "XF86AudioPlay" = "exec mpc toggle";
# "XF86AudioStop" = "exec mpc stop";
# Kill focused window
"${super}+c" = "kill";
"${alt}+F4" = "kill";
# Change focus
"${super}+Left" = "focus left";
"${super}+Down" = "focus down";
"${super}+Up" = "focus up";
"${super}+Right" = "focus right";
"${super}+h" = "focus left";
"${super}+j" = "focus down";
"${super}+k" = "focus up";
"${super}+l" = "focus right";
# Move focused window
"${super}+Shift+Left" = "move left";
"${super}+Shift+Down" = "move down";
"${super}+Shift+Up" = "move up";
"${super}+Shift+Right" = "move right";
"${super}+Shift+h" = "move left";
"${super}+Shift+j" = "move down";
"${super}+Shift+k" = "move up";
"${super}+Shift+l" = "move right";
# Change split modes
"${super}+b" = "split h";
"${super}+v" = "split v";
"${super}+s" = "layout toggle split";
"${super}+w" = "layout tabbed";
# Enter fullscreen
"${super}+f" = "fullscreen toggle";
# Toggle floating windows
"${super}+space" = "floating toggle";
# Restart / Exit i3
"${super}+Shift+r" = "restart";
"${super}+q" = "exec i3-nagbar -m 'Exit?' -b 'Yes' 'i3-msg exit'";
# Modes
"${super}+r" = "mode Resize";
"${super}+Shift+g" = "mode Gaps";
# Workspace switching
"${super}+1" = "workspace number $ws1";
"${super}+2" = "workspace number $ws2";
"${super}+3" = "workspace number $ws3";
"${super}+4" = "workspace number $ws4";
"${super}+5" = "workspace number $ws5";
"${super}+6" = "workspace number $ws6";
"${super}+7" = "workspace number $ws7";
"${super}+8" = "workspace number $ws8";
"${super}+9" = "workspace number $ws9";
"${super}+0" = "workspace number $ws10";
"${alt}+Control+Left" = "workspace prev";
"${alt}+Control+Right" = "workspace next";
"${alt}+Control+h" = "workspace prev";
"${alt}+Control+l" = "workspace next";
"${super}+Shift+1" = "move container to workspace number $ws1";
"${super}+Shift+2" = "move container to workspace number $ws2";
"${super}+Shift+3" = "move container to workspace number $ws3";
"${super}+Shift+4" = "move container to workspace number $ws4";
"${super}+Shift+5" = "move container to workspace number $ws5";
"${super}+Shift+6" = "move container to workspace number $ws6";
"${super}+Shift+7" = "move container to workspace number $ws7";
"${super}+Shift+8" = "move container to workspace number $ws8";
"${super}+Shift+9" = "move container to workspace number $ws9";
"${super}+Shift+0" = "move container to workspace number $ws10";
};
modes = {
"Resize" = {
"Left" = "resize shrink width 5 px or 5 ppt";
"Down" = "resize grow height 5 px or 5 ppt";
"Up" = "resize shrink height 5 px or 5 ppt";
"Right" = "resize grow width 5 px or 5 ppt";
"Return" = "mode default";
};
"Gaps" = {
"o" = "mode Outer";
"i" = "mode Inner";
"h" = "mode Horizontal";
"v" = "mode Vertical";
"t" = "mode Top";
"r" = "mode Right";
"b" = "mode Bottom";
"l" = "mode Left";
"Return" = "mode Gaps";
"Escape" = "mode default";
};
} // genGapsModes [
"Outer"
"Inner"
"Horizontal"
"Vertical"
"Top"
"Right"
"Bottom"
"Left"
];
};
extraConfig = ''
set $ws1 "1:code"
set $ws2 "2:web"
set $ws3 "3:discord"
set $ws4 "4:game"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8:steam"
set $ws9 "9:spotify"
set $ws10 "10:term"
'';
};
}

80
cfg/winter/rin/neovim.nix Normal file
View file

@ -0,0 +1,80 @@
{ config, pkgs, ... }:
let
vim-material = pkgs.vimUtils.buildVimPlugin {
name = "vim-material";
src = pkgs.fetchFromGitHub {
owner = "hzchirs";
repo = "vim-material";
rev = "05461c967b861ef532c44d5348555febac94b0d5";
sha256 = "1w59zqrx3scqsrg1a43497xybc3m4zm00kwfqpvjfw6qrpk2zb3f";
};
};
in {
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
# nerdtree
# vim-fugitive
ale
coc-nvim
vim-airline
vim-material
vim-nix
vim-surround
lf-vim
vim-floaterm
];
withNodeJs = true;
extraConfig = ''
" configuration
syntax enable
set relativenumber number
set noswapfile
set hlsearch
set ignorecase
set incsearch
set title
set clipboard^=unnamed
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
set expandtab
" theming
set termguicolors
hi MatchParen cterm=underline ctermbg=none ctermfg=white
let g:material_style='oceanic'
let g:airline_theme='material'
set background=dark
colorscheme vim-material
" using tab for trigger completion
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
inoremap <silent><expr> <c-space> coc#refresh()
" various aliases
nnoremap <c-p> :Lf<CR>
nnoremap <leader>r :source $MYVIMRC<CR>
command! -nargs=0 Sw w !doas tee % > /dev/null
" disable read-only warning
au BufEnter * set noro
" disable empty line tildes
set fcs=eob:\
'';
};
}

37
cfg/winter/rin/picom.nix Normal file
View file

@ -0,0 +1,37 @@
{ config, ... }: {
services.picom = {
enable = true;
experimentalBackends = true;
blur = true;
blurExclude = [
"class_g != 'Alacritty' && class_g != 'Polybar'"
];
fade = true;
fadeDelta = 5;
fadeSteps = [ "0.05" "0.05" ];
inactiveOpacity = "0.8";
vSync = true;
extraOptions = ''
glx-no-stencil = true;
glx-copy-from-front = false;
glx-no-rebind-pixmap = true;
use-damage = true;
blur-method = "dual_kawase";
blur-strength = 5;
unredir-if-possible = true;
detect-transient = true;
detect-client-leader = true;
detect-client-opacity = true;
detect-rounded-corners = true;
use-ewmh-active-win = true;
mark-wmwin-focused = true;
mark-ovredir-focused = true;
'';
};
}

289
cfg/winter/rin/polybar.nix Normal file
View file

@ -0,0 +1,289 @@
{ config, ... }:
let
memoryBar = {
width = 20;
foreground = [
"#aaff77"
"#aaff77"
"#fba922"
"#ff5555"
];
indicator = {
text = "|";
font = 6;
foreground = "#fff";
};
fill = {
text = "";
font = 6;
};
empty = {
text = "";
font = 6;
foreground = "#444444";
};
};
formatRampCoreload = text: color: {
inherit text;
font = 2;
foreground = color;
};
in {
services.polybar = {
enable = true;
script = builtins.readFile ./scripts/polybar.sh;
settings = rec {
_base = {
monitor = "eDP-1";
width = "100%";
height = 22;
background = "#00";
foreground = "#fff";
line = {
color = "#00";
size = 1;
};
};
"bar/top" = _base // {
spacing = 2;
padding = {
right = 5;
bottom = 5;
left = 5;
};
font = [
"NotoSans-Regular:size=8.2;2"
"MaterialIcons:size=10;1"
"FontAwesome:size=10;3"
"NotoSans-Regular:size=10;2"
"MaterialIcons:size=12;4"
"FontAwesome5Brands:style=Solid:pixelsize=10;1"
"HanaMinA:size=9.8;1"
"HanaMinB:size=9.8;1"
];
# enable-ipc = true;
modules = {
# left = "previous playpause next spotify";
left = "title";
right = "datetime";
};
};
"bar/bottom" = _base // {
bottom = true;
spacing = 3;
padding = {
top = 5;
right = 5;
};
module.margin = {
left = 2;
right = 2;
};
font = [
"NotoSans-Regular:size=8.2;1"
"unifont:size=6;1"
"FontAwesome:size=10;1"
"NotoSans-Regular:size=10;1"
"MaterialIcons:size=12;4"
"FontAwesome5Brands:style=Solid:pixelsize=10;1"
];
modules = {
left = "i3";
right = "fs cpu memory swap wifi";
};
tray = {
position = "right";
padding = 2;
scale = 1.1;
};
};
"module/i3" = {
type = "internal/i3";
format = "<label-state> <label-mode>";
strip.wsnumbers = true;
wrapping.scroll = false;
ws.icon = {
text = [
"1:code;"
"2:web;"
"3:discord;%{T6}"
"4:game;"
"8:steam;"
"9:spotify;"
"10:term;"
];
default = "";
};
label = {
mode = {
text = "%mode%";
padding = 5;
};
dimmed.underline = _base.background;
focused = {
text = "%icon%";
foreground = "#fff";
background = "#773f3f3f";
underline = "#c9665e";
font = 4;
padding = 4;
};
unfocused = {
text = "%icon%";
foreground = "#fff";
background = "#00";
underline = "#00";
font = 4;
padding = 4;
};
visible = {
text = "%index%";
underline = "#555555";
padding = 4;
};
urgent = {
text = "%icon%";
foreground = "#00";
background = "#bd2c40";
underline = "#9b0a20";
font = 4;
padding = 4;
};
};
};
"module/cpu" = {
type = "internal/cpu";
interval = 0.5;
label = "CPU %percentage%%";
format = {
text = "<label> <ramp-coreload>";
underline = "#00f5ff";
};
ramp.coreload = [
( formatRampCoreload "" "#aaff77" )
( formatRampCoreload "" "#aaff77" )
( formatRampCoreload "" "#aaff77" )
( formatRampCoreload "" "#aaff77" )
( formatRampCoreload "" "#fba922" )
( formatRampCoreload "" "#fba922" )
( formatRampCoreload "" "#ff5555" )
( formatRampCoreload "" "#ff5555" )
];
};
"module/datetime" = {
type = "internal/date";
date = {
text = "%{T1}%%{F#ccc}%A, %d %B %Y %{T4}%%{F#fff}%H:%M%%{F#666}:%%{F#ccc}%S%%{F-}";
alt = "%{T1}%%{F#ccc}%Y-%m-%d%%{F-} %{T4}%%{F#fff}%H:%M%%{F-}";
};
format = {
overline = "#fff";
background = _base.background;
padding = 4;
};
};
"module/fs" = {
type = "internal/fs";
format.mounted = {
text = "<label-mounted>";
underline = "#ffea61";
};
label.mounted = "%mountpoint% %free%";
mount = [
"/home"
"/mnt/hdd"
];
fixed-values = true;
};
"module/memory" = {
type = "internal/memory";
format = {
text = "<label> <bar-used>";
underline = "#aaff77";
};
label = "RAM %gb_used%";
bar.used = memoryBar;
};
"module/swap" = {
type = "internal/memory";
format = {
text = "<label> <bar-swap-used>";
underline = "#fba922";
};
label = "SWAP %gb_swap_used%";
bar.swap.used = memoryBar;
};
"module/title" = {
type = "internal/xwindow";
format = {
text = "%{T4}<label>";
overline = "#fff";
padding = 6;
};
};
"module/wifi" = {
type = "internal/network";
interface = "wlp3s0";
interval = 3;
ping.interval = 30;
format = {
connected = "<ramp-signal>";
packetloss = "<animation-packetloss>";
};
label.disconnected = {
text = " not connected";
foreground = "#66";
};
ramp.signal = [
""
""
""
""
""
];
animation.packetloss = {
text = [
{
text = "";
foreground = "#ffa64c";
}
{
text = "";
foreground = _base.foreground;
}
];
framerate = 500;
};
};
};
};
}

7
cfg/winter/rin/rofi.nix Normal file
View file

@ -0,0 +1,7 @@
{ config, ... }: {
programs.rofi = {
font = "Open Sans 10";
scrollbar = false;
#theme = builtins.fetchUrl {};
};
}

View file

@ -0,0 +1,4 @@
#!/bin/sh
polybar top >>/tmp/bar-top.log 2>&1 &
polybar bottom >>/tmp/bar-bottom.log 2>&1 &

10
cfg/winter/rin/scripts/xinitrc Executable file
View file

@ -0,0 +1,10 @@
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
eval $(dbus-launch --exit-with-session --sh-syntax)
fi
systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment > /dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fi
exec ~/.xsession

165
cfg/winter/rin/zsh.nix Normal file
View file

@ -0,0 +1,165 @@
{ config, pkgs, ... }:
let
lib = pkgs.lib;
abbrs = {
e = "$EDITOR";
rs = "source ~/.config/zsh/.zshrc";
ll = "ls -al";
q = "exit";
peach = "ssh lava@peach";
bunny = "ssh bunny@peach";
fa = "grep -Inr";
fai = "grep -Iinr";
g1 = "xgamma -gamma 1";
g3 = "xgamma -gamma 1.3";
bat = "echo 'battery' | doas tee /sys/class/drm/card1/device/power_dpm_state";
bal = "echo 'balanced' | doas tee /sys/class/drm/card1/device/power_dpm_state";
sclk = "doas setclock 50000 70000 800";
sysu = "doas systemctl restart";
sysd = "doas systemctl stop";
syss = "doas systemctl status";
usysu = "systemctl --user restart";
usysd = "systemctl --user stop";
usyss = "systemctl --user status";
j = "doas journalctl -b";
jf = "doas journalctl -f";
fl = "cd ~/Projects/flakes";
nr = "doas nixos-rebuild switch --flake .#winter -v";
gs = "git status";
ga = "git add .";
gc = "git commit";
gac = "git add .; git commit";
gcm = "git commit -m";
gco = "git checkout";
gd = "git diff";
gf = "git commit --amend --no-edit";
gl = "git log";
gr = "git rebase -i";
};
genAbbrs = lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "abbr add -S --quiet ${k}=${lib.escapeShellArg v}") abbrs);
cursorShape = ''
function zle-keymap-select {
if [[ $KEYMAP == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ $KEYMAP == main ]] ||
[[ $KEYMAP == viins ]] ||
[[ $KEYMAP = "" ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q'
preexec() { echo -ne '\e[5 q' ;}
'';
viExtraNav = ''
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
bindkey -v '^R' history-incremental-pattern-search-backward
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
'';
in rec {
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
enableAutosuggestions = true;
autocd = true;
defaultKeymap = "viins";
history = {
extended = true;
path = "${config.xdg.dataHome}/zsh/history";
save = 10000000;
size = 10000000;
};
enableCompletion = true;
initExtraBeforeCompInit = ''
zstyle ':completion:*' completer _complete
zstyle ':completion:*' matcher-list "" 'm:{[:lower:][:upper:]-_}={[:upper:][:lower:]_-}' '+l:|=* r:|=*'
zstyle ':completion:*' menu select
_comp_options+=(globdots)
zmodload zsh/complist
'';
sessionVariables = {
WINEPREFIX = "${config.xdg.dataHome}/wine64";
WINEARCH = "win64";
EDITOR = "nvim";
};
localVariables = {
PS1 = "%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b ";
ZSH_AUTOSUGGEST_STRATEGY = ["completion"];
ZSH_AUTOSUGGEST_USE_ASYNC = true;
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE = 40;
};
shellAliases = {
ls = "ls --color=tty -v";
diff = "diff -Naur --color=always";
};
initExtraFirst = ''
autoload -U colors && colors
'';
initExtra = lib.concatStringsSep "\n" [
cursorShape
genAbbrs
viExtraNav
];
plugins = [
{
name = "zsh-abbr";
src = pkgs.fetchFromGitHub {
owner = "olets";
repo = "zsh-abbr";
rev = "99af0455b7b86ff3894a4bcf73380be2d595fa54";
sha256 = "014zvikfqqcv40x24h60ad3vyjz6kf9f7xhkk6iz7qyxwgcs90zs";
};
}
{
name = "zsh-history-substring-search";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
};
}
{
name = "fast-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zdharma";
repo = "fast-syntax-highlighting";
rev = "817916dfa907d179f0d46d8de355e883cf67bd97";
sha256 = "0m102makrfz1ibxq8rx77nngjyhdqrm8hsrr9342zzhq1nf4wxxc";
};
}
];
};
}

27
flake.lock generated
View file

@ -1,5 +1,25 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1621135068,
"narHash": "sha256-aPJlgosfLp3QtPDFLf/N7qNpIo5Q45MpYyzlaACL2G4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "77188bcd6e2c6c7a99253b36f08ed7b65f2901d2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1620901170,
@ -18,17 +38,18 @@
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"secrets": "secrets"
}
},
"secrets": {
"locked": {
"lastModified": 1621051136,
"narHash": "sha256-3eEwOo2ncOmCh2nDc7kyiA3BS3zp5TOp3PtoJMDT8gk=",
"lastModified": 1621183588,
"narHash": "sha256-liXvLHfUDyWvWzNCTNEwJQu/nSAXpy8XHcuzpX36CyU=",
"owner": "LavaDesu",
"repo": "flakes-secrets",
"rev": "e701ac0c29f6917c7bf8e24360fbd0e72c7ed7f5",
"rev": "a7e33c0223639ada24f0ae56d185f5bf6d5bd900",
"type": "github"
},
"original": {

View file

@ -1,16 +1,23 @@
{
inputs = {
nixpkgs = { url = "github:NixOS/nixpkgs/nixos-unstable"; };
#secrets = { url = "git+ssh://git@github.com/LavaDesu/flakes-secrets.git"; };
home-manager = { url = "github:nix-community/home-manager"; };
secrets = { url = "github:LavaDesu/flakes-secrets"; };
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, secrets }: with nixpkgs.lib;
outputs = inputs: with inputs;
let
base = {
system.configurationRevision = mkIf (self ? rev) self.rev;
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
nix.registry.nixpkgs.flake = nixpkgs;
};
hm-module = {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.rin = import ./cfg/winter/rin/home.nix; # TODO: decoupling
};
overlays = {
linux = import ./overlays/linux.nix;
picom = import ./overlays/picom.nix;
@ -28,14 +35,15 @@
};
in
{
nixosConfigurations."winter" = nixosSystem {
nixosConfigurations."winter" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
base
secrets.nixosModules.winter
./cfg/winter
home-manager.nixosModules.home-manager hm-module
secrets.nixosModules.winter
];
specialArgs = { inherit overlays; };
specialArgs = { inherit inputs overlays; };
};
};
}