diff --git a/cfg/winter/default.nix b/cfg/winter/default.nix index ac48a18..b28ad7e 100644 --- a/cfg/winter/default.nix +++ b/cfg/winter/default.nix @@ -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; diff --git a/cfg/winter/packages.nix b/cfg/winter/packages.nix index 6c843d2..da7c478 100644 --- a/cfg/winter/packages.nix +++ b/cfg/winter/packages.nix @@ -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; } diff --git a/cfg/winter/rin/alacritty.nix b/cfg/winter/rin/alacritty.nix new file mode 100644 index 0000000..a87d0ee --- /dev/null +++ b/cfg/winter/rin/alacritty.nix @@ -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; + }; + }; +} diff --git a/cfg/winter/rin/default.nix b/cfg/winter/rin/default.nix new file mode 100644 index 0000000..dc12944 --- /dev/null +++ b/cfg/winter/rin/default.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: { + users.users.rin = { + isNormalUser = true; + extraGroups = [ "audio" "video" "wheel" ]; + shell = pkgs.zsh; + }; +} diff --git a/cfg/winter/rin/dunst.nix b/cfg/winter/rin/dunst.nix new file mode 100644 index 0000000..9699e94 --- /dev/null +++ b/cfg/winter/rin/dunst.nix @@ -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 = "%s\\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; + }; + }; + }; +} diff --git a/cfg/winter/rin/gtk.nix b/cfg/winter/rin/gtk.nix new file mode 100644 index 0000000..dc55f87 --- /dev/null +++ b/cfg/winter/rin/gtk.nix @@ -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; + }; + }; +} diff --git a/cfg/winter/rin/home.nix b/cfg/winter/rin/home.nix new file mode 100644 index 0000000..f4a1a1f --- /dev/null +++ b/cfg/winter/rin/home.nix @@ -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 ]); + }; + }; +} diff --git a/cfg/winter/rin/i3.nix b/cfg/winter/rin/i3.nix new file mode 100644 index 0000000..0033839 --- /dev/null +++ b/cfg/winter/rin/i3.nix @@ -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" + ''; + }; +} diff --git a/cfg/winter/rin/neovim.nix b/cfg/winter/rin/neovim.nix new file mode 100644 index 0000000..3f0953e --- /dev/null +++ b/cfg/winter/rin/neovim.nix @@ -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 + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() + + inoremap coc#refresh() + + " various aliases + nnoremap :Lf + nnoremap r :source $MYVIMRC + command! -nargs=0 Sw w !doas tee % > /dev/null + + " disable read-only warning + au BufEnter * set noro + + " disable empty line tildes + set fcs=eob:\ + ''; + }; +} diff --git a/cfg/winter/rin/picom.nix b/cfg/winter/rin/picom.nix new file mode 100644 index 0000000..d87059c --- /dev/null +++ b/cfg/winter/rin/picom.nix @@ -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; + ''; + }; +} diff --git a/cfg/winter/rin/polybar.nix b/cfg/winter/rin/polybar.nix new file mode 100644 index 0000000..c4e7c47 --- /dev/null +++ b/cfg/winter/rin/polybar.nix @@ -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 = " "; + 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 = "