From b51f9bc1014ce350abe73f2c419e0bf6512194c2 Mon Sep 17 00:00:00 2001 From: Andrey0189 Date: Wed, 17 Apr 2024 05:52:14 +0500 Subject: Initial commit --- home-manager/home.nix | 13 ++ home-manager/modules/alacritty.nix | 19 ++ home-manager/modules/bundle.nix | 12 ++ home-manager/modules/cursor.nix | 14 ++ home-manager/modules/git.nix | 7 + home-manager/modules/htop.nix | 8 + home-manager/modules/qt.nix | 16 ++ home-manager/modules/wms/hyprland.nix | 210 +++++++++++++++++++++ home-manager/modules/wms/waybar.nix | 345 ++++++++++++++++++++++++++++++++++ home-manager/zsh.nix | 37 ++++ 10 files changed, 681 insertions(+) create mode 100644 home-manager/home.nix create mode 100644 home-manager/modules/alacritty.nix create mode 100644 home-manager/modules/bundle.nix create mode 100644 home-manager/modules/cursor.nix create mode 100644 home-manager/modules/git.nix create mode 100644 home-manager/modules/htop.nix create mode 100644 home-manager/modules/qt.nix create mode 100644 home-manager/modules/wms/hyprland.nix create mode 100644 home-manager/modules/wms/waybar.nix create mode 100644 home-manager/zsh.nix (limited to 'home-manager') diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100644 index 0000000..e2ea67f --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,13 @@ +{ + + imports = [ + ./zsh.nix + ./modules/bundle.nix + ]; + + home = { + username = "amper"; + homeDirectory = "/home/amper"; + stateVersion = "23.11"; + }; +} diff --git a/home-manager/modules/alacritty.nix b/home-manager/modules/alacritty.nix new file mode 100644 index 0000000..4b986c6 --- /dev/null +++ b/home-manager/modules/alacritty.nix @@ -0,0 +1,19 @@ +{ + programs.alacritty = { + enable = true; + settings = { + window.opacity = 0.95; + + font = { + size = 13.0; + # draw_bold_text_with_bright_colors = true; + normal = { + family = "JetBrains Mono"; + style = "Bold"; + }; + }; + + colors.primary.background = "#1d2021"; + }; + }; +} diff --git a/home-manager/modules/bundle.nix b/home-manager/modules/bundle.nix new file mode 100644 index 0000000..3f58742 --- /dev/null +++ b/home-manager/modules/bundle.nix @@ -0,0 +1,12 @@ +{ + imports = [ + ./cursor.nix + ./git.nix + ./htop.nix + ./alacritty.nix + ./qt.nix + + ./wms/hyprland.nix + ./wms/waybar.nix + ]; +} diff --git a/home-manager/modules/cursor.nix b/home-manager/modules/cursor.nix new file mode 100644 index 0000000..85bea31 --- /dev/null +++ b/home-manager/modules/cursor.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: { + home = { + pointerCursor = { + package = pkgs.vanilla-dmz; + name = "Vanilla-DMZ"; + size = 36; + gtk.enable = true; + x11 = { + enable = true; + defaultCursor = true; + }; + }; + }; +} diff --git a/home-manager/modules/git.nix b/home-manager/modules/git.nix new file mode 100644 index 0000000..c3dbae7 --- /dev/null +++ b/home-manager/modules/git.nix @@ -0,0 +1,7 @@ +{ + programs.git = { + enable = true; + userName = "Andrey0189"; + userEmail = "varnavsky06@gmail.com"; + }; +} diff --git a/home-manager/modules/htop.nix b/home-manager/modules/htop.nix new file mode 100644 index 0000000..a781214 --- /dev/null +++ b/home-manager/modules/htop.nix @@ -0,0 +1,8 @@ +{ + programs.htop = { + enable = true; + settings = { + tree_view = 1; + }; + }; +} diff --git a/home-manager/modules/qt.nix b/home-manager/modules/qt.nix new file mode 100644 index 0000000..795b2d3 --- /dev/null +++ b/home-manager/modules/qt.nix @@ -0,0 +1,16 @@ +{ + qt = { + enable = true; + platformTheme = "qtct"; + style.name = "kvantum"; + }; + + # xdg.configFile = { + # "Kvantum/kvantum.kvconfig".text = '' + # [General] + # theme=GraphiteNordDark + # ''; + # + # "Kvantum/GraphiteNord".source = "${pkgs.graphite-kde-theme}/share/Kvantum/GraphiteNord"; + # }; +} diff --git a/home-manager/modules/wms/hyprland.nix b/home-manager/modules/wms/hyprland.nix new file mode 100644 index 0000000..9f52da2 --- /dev/null +++ b/home-manager/modules/wms/hyprland.nix @@ -0,0 +1,210 @@ +{ + wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; + + settings = { + "$mainMod" = "SUPER"; + + monitor = ",preferred,auto,1"; + + env = [ + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_TYPE,wayland" + "XDG_SESSION_DESKTOP,Hyprland" + "XCURSOR_SIZE,36" + "QT_QPA_PLATFORM,wayland" + "XDG_SCREENSHOTS_DIR,~/screens" + ]; + + debug = { + disable_logs = false; + enable_stdout_logs = true; + }; + + input = { + kb_layout = "us,ru"; + kb_variant = "lang"; + kb_options = "grp:caps_toggle"; + + follow_mouse = 1; + + touchpad = { + natural_scroll = false; + }; + + sensitivity = 0; # -1.0 - 1.0, 0 means no modification. + }; + + general = { + gaps_in = 5; + gaps_out = 20; + border_size = 3; + "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + + layout = "dwindle"; + + no_cursor_warps = false; + }; + + decoration = { + rounding = 10; + + blur = { + enabled = true; + size = 16; + passes = 2; + new_optimizations = true; + }; + + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + "col.shadow" = "rgba(1a1a1aee)"; + }; + + animations = { + enabled = true; + + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + # bezier = "myBezier, 0.33, 0.82, 0.9, -0.08"; + + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true; # you probably want this + }; + + master = { + new_is_master = true; + }; + + gestures = { + workspace_swipe = true; + workspace_swipe_fingers = 3; + workspace_swipe_invert = false; + workspace_swipe_distance = 200; + }; + + misc = { + animate_manual_resizes = true; + animate_mouse_windowdragging = true; + enable_swallow = true; + render_ahead_of_time = false; + disable_hyprland_logo = true; + }; + + windowrule = [ + "float, ^(imv)$" + "float, ^(mpv)$" + ]; + + exec-once = [ + "swww init" + "swww img ~/Downloads/nixos-chan.png" + "waybar" + "wl-paste --type text --watch cliphist store" + "wl-paste --type image --watch cliphist store" + ]; + + bind = [ + "$mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy" + + "$mainMod, Return, exec, alacritty" + "$mainMod, Q, killactive," + "$mainMod, M, exit," + "$mainMod, E, exec, dolphin" + "$mainMod, F, togglefloating," + "$mainMod, D, exec, wofi --show drun" + "$mainMod, P, pseudo, # dwindle" + "$mainMod, J, togglesplit, # dwindle" + + # Move focus with mainMod + arrow keys + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + + # Moving windows + "$mainMod SHIFT, left, swapwindow, l" + "$mainMod SHIFT, right, swapwindow, r" + "$mainMod SHIFT, up, swapwindow, u" + "$mainMod SHIFT, down, swapwindow, d" + + # Window resizing X Y + "$mainMod CTRL, left, resizeactive, -60 0" + "$mainMod CTRL, right, resizeactive, 60 0" + "$mainMod CTRL, up, resizeactive, 0 -60" + "$mainMod CTRL, down, resizeactive, 0 60" + + # Switch workspaces with mainMod + [0-9] + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, workspace, 10" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mainMod SHIFT, 1, movetoworkspacesilent, 1" + "$mainMod SHIFT, 2, movetoworkspacesilent, 2" + "$mainMod SHIFT, 3, movetoworkspacesilent, 3" + "$mainMod SHIFT, 4, movetoworkspacesilent, 4" + "$mainMod SHIFT, 5, movetoworkspacesilent, 5" + "$mainMod SHIFT, 6, movetoworkspacesilent, 6" + "$mainMod SHIFT, 7, movetoworkspacesilent, 7" + "$mainMod SHIFT, 8, movetoworkspacesilent, 8" + "$mainMod SHIFT, 9, movetoworkspacesilent, 9" + "$mainMod SHIFT, 0, movetoworkspacesilent, 10" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + + # Keyboard backlight + "$mainMod, F3, exec, brightnessctl -d *::kbd_backlight set +33%" + "$mainMod, F2, exec, brightnessctl -d *::kbd_backlight set 33%-" + + # Volume and Media Control + ", XF86AudioRaiseVolume, exec, pamixer -i 5 " + ", XF86AudioLowerVolume, exec, pamixer -d 5 " + ", XF86AudioMute, exec, pamixer -t" + ", XF86AudioMicMute, exec, pamixer --default-source -m" + + # Configuration files + ''$mainMod SHIFT, N, exec, alacritty -e sh -c "rb"'' + ''$mainMod SHIFT, C, exec, alacritty -e sh -c "conf"'' + ''$mainMod SHIFT, H, exec, alacritty -e sh -c "nvim ~/nix/home-manager/modules/wms/hyprland.nix"'' + ''$mainMod SHIFT, W, exec, alacritty -e sh -c "nvim ~/nix/home-manager/modules/wms/waybar.nix'' + '', Print, exec, grim -g "$(slurp)" - | swappy -f -'' + + # Waybar + "$mainMod, B, exec, pkill -SIGUSR1 waybar" + "$mainMod, W, exec, pkill -SIGUSR2 waybar" + + # Disable all effects + "$mainMod Shift, G, exec, ~/.config/hypr/gamemode.sh " + ]; + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + }; + }; +} diff --git a/home-manager/modules/wms/waybar.nix b/home-manager/modules/wms/waybar.nix new file mode 100644 index 0000000..34e8e43 --- /dev/null +++ b/home-manager/modules/wms/waybar.nix @@ -0,0 +1,345 @@ +{ + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + margin = "9 13 -10 18"; + + modules-left = ["hyprland/workspaces" "hyprland/language" "keyboard-state" "hyprland/submap"]; + modules-center = ["clock" "custom/weather"]; + modules-right = ["pulseaudio" "custom/mem" "cpu" "backlight" "battery" "tray"]; + + "hyprland/workspaces" = { + disable-scroll = true; + }; + + "hyprland/language" = { + format-en = "US"; + format-ru = "RU"; + min-length = 5; + tooltip = false; + }; + + "keyboard-state" = { + #numlock = true; + capslock = true; + format = "{icon} "; + format-icons = { + locked = " "; + unlocked = ""; + }; + }; + + "clock" = { + # timezone = "America/New_York"; + tooltip-format = "{:%Y %B}\n{calendar}"; + format = "{:%a; %d %b, %I:%M %p}"; + }; + + "custom/weather" = { + format = "{}"; + tooltip = true; + interval = 1800; + exec = "$HOME/.config/waybar/scripts/wttr.py"; + return-type = "json"; + }; + + "pulseaudio" = { + # scroll-step = 1; # %, can be a float + reverse-scrolling = 1; + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + on-click = "pavucontrol"; + min-length = 13; + }; + + "custom/mem" = { + format = "{} "; + interval = 3; + exec = "free -h | awk '/Mem:/{printf $3}'"; + tooltip = false; + }; + + "cpu" = { + interval = 2; + format = "{usage}% "; + min-length = 6; + }; + + "temperature" = { + # thermal-zone = 2; + # hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + critical-threshold = 80; + # format-critical = "{temperatureC}°C {icon}"; + format = "{temperatureC}°C {icon}"; + format-icons = ["" "" "" "" ""]; + tooltip = false; + }; + + "backlight" = { + device = "intel_backlight"; + format = "{percent}% {icon}"; + format-icons = [""]; + min-length = 7; + }; + + battery = { + states = { + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + format-icons = ["" "" "" "" "" "" "" "" "" ""]; + on-update = "$HOME/.config/waybar/scripts/check_battery.sh"; + }; + + tray = { + icon-size = 16; + spacing = 0; + }; + + }; + }; + + style = + '' +* { + border: none; + border-radius: 0; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: JetBrains Mono; + font-weight: bold; + min-height: 20px; +} + +window#waybar { + background: transparent; +} + +window#waybar.hidden { + opacity: 0.2; +} + +#workspaces { + margin-right: 8px; + border-radius: 10px; + transition: none; + background: #383c4a; +} + +#workspaces button { + transition: none; + color: #7c818c; + background: transparent; + padding: 5px; + font-size: 18px; +} + +#workspaces button.persistent { + color: #7c818c; + font-size: 12px; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +#workspaces button:hover { + transition: none; + box-shadow: inherit; + text-shadow: inherit; + border-radius: inherit; + color: #383c4a; + background: #7c818c; +} + +#workspaces button.active { + background: #4e5263; + color: white; + border-radius: inherit; +} + +#language { + padding-left: 16px; + padding-right: 8px; + border-radius: 10px 0px 0px 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#keyboard-state { + margin-right: 8px; + padding-right: 16px; + border-radius: 0px 10px 10px 0px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#custom-pacman { + padding-left: 16px; + padding-right: 8px; + border-radius: 10px 0px 0px 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#custom-mail { + margin-right: 8px; + padding-right: 16px; + border-radius: 0px 10px 10px 0px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#submap { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#clock { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px 0px 0px 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#custom-weather { + padding-right: 16px; + border-radius: 0px 10px 10px 0px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#pulseaudio { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; +} + +#custom-mem { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#cpu { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#temperature { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#backlight { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#battery { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +#battery.charging { + color: #ffffff; + background-color: #26A65B; +} + +#battery.warning:not(.charging) { + background-color: #ffbe61; + color: black; +} + +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#tray { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: #383c4a; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + ''; + }; +} diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix new file mode 100644 index 0000000..7ce1349 --- /dev/null +++ b/home-manager/zsh.nix @@ -0,0 +1,37 @@ +{ config, ... }: { + programs.zsh = { + enable = true; + enableCompletion = true; + # enableAutosuggestions = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + shellAliases = + let + flakeDir = "~/nix"; + in { + rb = "sudo nixos-rebuild switch --flake ${flakeDir}"; + upd = "nix flake update ${flakeDir}"; + upg = "sudo nixos-rebuild switch --upgrade --flake ${flakeDir}"; + + hms = "home-manager switch --flake ${flakeDir}"; + + conf = "nvim ${flakeDir}/nixos/configuration.nix"; + pkgs = "nvim ${flakeDir}/nixos/packages.nix"; + + ll = "ls -l"; + v = "nvim"; + se = "sudoedit"; + ff = "fastfetch"; + }; + + history.size = 10000; + history.path = "${config.xdg.dataHome}/zsh/history"; + + oh-my-zsh = { + enable = true; + plugins = [ "git" "sudo" ]; + theme = "agnoster"; # blinks is also really nice + }; + }; +} -- cgit v1.2.3