diff --git a/src/system/machines/desktop/hardware.nix b/src/system/machines/desktop/hardware.nix index a3278ba..c5abf99 100644 --- a/src/system/machines/desktop/hardware.nix +++ b/src/system/machines/desktop/hardware.nix @@ -3,15 +3,29 @@ { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; -# Kernel - boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.extraModulePackages = [ ]; - boot.kernelPackages = pkgs.linuxPackages_latest; - boot.kernelParams = [ "intel_iommu=on" ]; - boot.kernelModules = [ "kvm-intel" "virtio" "vfio-pci" "coretemp" ]; + boot = { + initrd = { + availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + kernelModules = [ "dm-snapshot" ]; + }; + extraModulePackages = [ ]; + kernelPackages = pkgs.linuxPackages_zen; + kernelParams = [ "intel_iommu=on" ]; + kernelModules = [ "kvm-intel" "virtio" "vfio-pci" "coretemp" ]; + }; + + environment.systemPackages = with pkgs; [ + linuxHeaders + + vulkan-headers + vulkan-loader + vulkan-tools + vulkan-extension-layer + + cudaPackages.cudatoolkit + cudaPackages.cudnn + ]; -# FStab fileSystems = { "/" = { device = "/dev/disk/by-uuid/d4e0a913-9ba8-451e-9086-b6d5d483dd9f"; @@ -29,16 +43,32 @@ }; }; -# GPU - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; + services.xserver.videoDrivers = ["nvidia"]; + + hardware = { + cpu = { + intel = { + updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + }; + }; + nvidia = { + modesetting.enable = true; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.mkDriver { + version = "550.90.07"; + sha256_64bit = "sha256-Uaz1edWpiE9XOh0/Ui5/r6XnhB4iqc7AtLvq4xsLlzM="; + openSha256 = "sha256-mRUTEWVsbjq+psVe+kAT6MjyZuLkG2yRDxCMvDJRL1I="; + settingsSha256 = "sha256-c30AQa4g4a1EHmaEu1yc05oqY01y+IusbBuq+P6rMCs="; + persistencedSha256 = "sha256-11tLSY8uUIl4X/roNnxf5yS2PQvHvoNjnd2CB67e870="; + }; + }; + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; }; - hardware.nvidia.open = true; - -# Virtualisation virtualisation.libvirtd = { enable = true; qemu = { @@ -47,8 +77,6 @@ }; }; -# CPU nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/src/system/machines/desktop/modules/home-manager/home.nix b/src/system/machines/desktop/modules/home-manager/home.nix index d034695..9af2e97 100644 --- a/src/system/machines/desktop/modules/home-manager/home.nix +++ b/src/system/machines/desktop/modules/home-manager/home.nix @@ -34,7 +34,7 @@ }; gui = { - wm.sway.enable = true; + wm.hyprland.enable = true; alacritty.enable = true; browsers.enable = true; diff --git a/src/user/modules/gui/modules/alacritty/config/alacritty.nix b/src/user/modules/gui/modules/alacritty/config/alacritty.nix index 92c7483..7e7ea9b 100644 --- a/src/user/modules/gui/modules/alacritty/config/alacritty.nix +++ b/src/user/modules/gui/modules/alacritty/config/alacritty.nix @@ -1,3 +1,9 @@ +{ config, ... }: + +let +hyprland = config.modules.user.gui.wm.hyprland; + +in { scrolling = { history = 10000; @@ -5,7 +11,7 @@ }; window = { - opacity = 1; + opacity = if hyprland.enable then 0.9 else 1; }; keyboard.bindings = [ diff --git a/src/user/modules/gui/modules/alacritty/default.nix b/src/user/modules/gui/modules/alacritty/default.nix index 23a4467..c181daf 100644 --- a/src/user/modules/gui/modules/alacritty/default.nix +++ b/src/user/modules/gui/modules/alacritty/default.nix @@ -14,7 +14,7 @@ in config = mkIf (cfg.enable && wm.enable) { programs.alacritty = { enable = true; - settings = import ./config/alacritty.nix; + settings = import ./config/alacritty.nix { inherit config; }; }; }; } diff --git a/src/user/modules/gui/modules/wm/hyprland/config/hyprland.nix b/src/user/modules/gui/modules/wm/hyprland/config/hyprland.nix deleted file mode 100644 index 464e522..0000000 --- a/src/user/modules/gui/modules/wm/hyprland/config/hyprland.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ config, lib, pkgs, ... }: - -with pkgs; -{ - enable = true; - xwayland.enable = true; - - settings = { - "$mod" = "ALT"; - "$terminal" = "${alacritty}"; - "$menu" = "${rofi} -show drun -show-icons -drun-icon-theme Qogir -font 'Noto Sans 14'"; - - monitor = [ - "HDMI-A-1, 1920X1080, 0x0, 1" - "DP-1, 1080x1920, 1920x0, 1, transform, 1" - ]; - - exec-once = [ - "waybar" - ]; - - bind = [ - "$mod, Enter, exec, $terminal" - "$mod, q, killactive" - - "$mod, J, swapwindow, d" - "$mod, K, swapwindow, u" - "$mod, H, swapwindow, l" - "$mod, L, swapwindow, r" - - "$mod, F, fullscreen" - - ", Print, exec, ${grim} ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png" - "SHIFT, Print, exec, ${grim} -g \"$(${slurp})\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png" - "$mod&SHIFT, F, exec, ${alacritty} -e sh -c 'EDITOR=nvim ${ranger}'" - #''$mod&SHIFT, Print, exec, sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png'"'' - - "$mod, D, exec, $menu" - "$mod&SHIFT, D, exec, ${rofi} -modi emoji -show emoji" - ] ++ ( builtins.concatLists (builtins.genList ( - x: let - ws = let - c = (x + 1) / 10; - in - builtins.toString (x + 1 - (c * 10)); - in - [ - "$mod, ${ws}, workspace, ${toString (x + 1)}" - "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" - ]) - 10) - ); - - bindm = [ - "$mod, mouse:272, movewindow" - ]; - - windowrulev2 = [ - "float, title:(Android Emulator)" - ]; - - input = { - kb_layout = "us"; - follow_mouse = 0; - accel_profile = "flat"; - sensitivity = 0.65; - }; - - env = [ - "HYPRCURSOR_SIZE, 24" - "GTK_THEME, Qogir" - ]; - - gaps_in = 10; - border_size = 0; - no_border_on_floating = true; - }; -} diff --git a/src/user/modules/gui/modules/wm/hyprland/config/waybar/config b/src/user/modules/gui/modules/wm/hyprland/config/waybar/config new file mode 100644 index 0000000..d18835f --- /dev/null +++ b/src/user/modules/gui/modules/wm/hyprland/config/waybar/config @@ -0,0 +1,119 @@ +{ + "layer": "top", + "position": "top", + "output": "HDMI-A-1", + "modules-left": ["custom/logo", "clock", "custom/weather", "custom/bitcoin", "memory", "cpu", "temperature"], + "modules-center": ["hyprland/workspaces"], + "modules-right": ["tray", "pulseaudio", "network"], + "reload_style_on_change":true, + + "custom/logo": { + "format": "", + "tooltip": false, + "on-click": "alacritty -e neofetch" + }, + + "hyprland/workspaces": { + "format": "{icon}", + "format-icons": { + "1": "", + "2": "", + "3": "", + "4": "", + "5": "", + "6": "", + "active": "", + "default": "" + }, + "persistent-workspaces": { + "*": [ 2, 3, 4, 5, 6 ] + } + }, + + "custom/weather": { + "format": "{}", + "return-type": "json", + "exec": "~/.config/waybar/scripts/weather.sh", + "interval": 10, + }, + + "custom/bitcoin": { + "format": "󰠓 :{}", + "interval": 30, + "exec": "~/.config/waybar/scripts/getBlock", + "on-click": "xdg-open https://www.mempool.space", + }, + + "clock": { + "format": "{:%I:%M:%S %p}", + "interval":1, + "tooltip-format": "\n{:%Y %B}\n{calendar}", + "calendar-weeks-pos": "right", + "today-format": "{}", + "format-calendar": "{}", + "format-calendar-weeks": "W{:%V}", + "format-calendar-weekdays": "{}" + }, + + "network": { + "format-wifi": "", + "format-ethernet":"󰌘", + "format-disconnected": "", + "tooltip-format": "{ipaddr}", + "tooltip-format-wifi": "{essid} ({signalStrength}%) | {ipaddr}", + "tooltip-format-ethernet": "{ifname} | {ipaddr}", + "tooltip-format-disconnected": "Offline", + "on-click": "alacritty -e nmtui" + }, + + "cpu": { + "interval": 1, + "format": ":{usage}%", + "min-length": 6, + "max-length": 6, + "format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"], + }, + + "memory": { + "format": "󱐋:{percentage}%" + }, + + "temperature": { + "format": "󱩱 :{temperatureC}°C", + "format-critical": "󰈸:{temperatureC}°C", + "interval": 1, + "critical-threshold": 80, + "on-click": "alacritty -e btop", + }, + + "pulseaudio": { + "format": "{icon}", + "format-bluetooth":"󰂰", + "format-muted": "", + "format-icons": { + "headphones": "", + "bluetooth": "󰥰", + "handsfree": "", + "headset": "󱡬", + "phone": "", + "portable": "", + "car": "", + "default": ["","",""] + }, + "justify": "center", + "on-click": "pavucontrol", + "tooltip-format": "{volume}%" + }, + + "jack": { + "format": "{} 󱎔", + "format-xrun": "{xruns} xruns", + "format-disconnected": "DSP off", + "realtime": true + }, + + "tray": { + "icon-size": 14, + "spacing": 10 + }, +} diff --git a/src/user/modules/gui/modules/wm/hyprland/config/waybar/default.nix b/src/user/modules/gui/modules/wm/hyprland/config/waybar/default.nix deleted file mode 100644 index 8d50d68..0000000 --- a/src/user/modules/gui/modules/wm/hyprland/config/waybar/default.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - enable = true; - settings = [ - { - mainBar = { - font-family = "Terminus"; - font-size = 12; - background-color = "rgba(10, 14, 20, 1)"; - color = "#FFFFFF"; - - layer = "top"; - output = [ - "HDMI-A-1" - ]; - - position = "top"; - height = 10; - - modules-left = [ - "hyprland/workspaces" - "wlr/taskbar" - ]; - - modules-center = [ - "clock" - ]; - - modules-right = [ - "memory" - "network" - "tray" - ]; - - "hyprland/workspaces" = { - active-only = true; - format = "{name}"; - }; - - "wlr/taskbar" = { - format = "{icon}"; - icon_size = 14; - icon-theme = "Qogir"; - tooltip-format = "{title}"; - on-click = "minimize-raise"; - ignore-list = [ - "Alacritty" - "rofi" - ]; - rewrite = { - "Firefox Web Browser" = "Firefox"; - }; - }; - - "clock" = { - format = "%I:%M:%S %p | %m-%d-%Y"; - interval = 60; - }; - - "memory" = { - format = "RAM: {percentage}%"; - interval = 30; - }; - - "network" = { - format-disconnected = "󰜺"; - format-wifi = "󰖩{essid}({signalStrength}%)"; - format-ethernet = "󰈁{cidr}"; - }; - - "tray" = { - icon_size = 16; - spacing = 10; - }; - }; - } - ]; -} diff --git a/src/user/modules/gui/modules/wm/hyprland/config/waybar/scripts/getBlock b/src/user/modules/gui/modules/wm/hyprland/config/waybar/scripts/getBlock new file mode 100755 index 0000000..a6b2903 Binary files /dev/null and b/src/user/modules/gui/modules/wm/hyprland/config/waybar/scripts/getBlock differ diff --git a/src/user/modules/gui/modules/wm/hyprland/config/waybar/scripts/weather.sh b/src/user/modules/gui/modules/wm/hyprland/config/waybar/scripts/weather.sh new file mode 100755 index 0000000..0eaeaf9 --- /dev/null +++ b/src/user/modules/gui/modules/wm/hyprland/config/waybar/scripts/weather.sh @@ -0,0 +1,24 @@ +#!/bin/sh +BSSIDS="$(nmcli device wifi list | + awk 'NR>1 {if ($1 != "*") {print $1}}' | + tr -d ":" | + tr "\n" ",")" + +LOC="" +REQUEST_GEO="$(wget -qO - http://openwifi.su/api/v1/bssids/"$BSSIDS")" +if [[ "$(jq ".count_results" <<< "$REQUEST_GEO")" -gt 0 ]] ; then + LAT="$(jq ".lat" <<< "$REQUEST_GEO")" + LON="$(jq ".lon" <<< "$REQUEST_GEO")" + LOC="$LAT,$LON" +fi + +text="$(curl -s "https://wttr.in/$LOC?format=1" | sed 's/ //g')" +tooltip="$(curl -s "https://wttr.in/$LOC?0QT" | + sed 's/\\/\\\\/g' | + sed ':a;N;$!ba;s/\n/\\n/g' | + sed 's/"/\\"/g')" + +if ! grep -q "Unknown location" <<< "$text"; then + echo "{\"text\": \"$text\", \"tooltip\": \"$tooltip\", \"class\": \"weather\"}" +fi + diff --git a/src/user/modules/gui/modules/wm/hyprland/config/waybar/style.css b/src/user/modules/gui/modules/wm/hyprland/config/waybar/style.css new file mode 100644 index 0000000..58e36c5 --- /dev/null +++ b/src/user/modules/gui/modules/wm/hyprland/config/waybar/style.css @@ -0,0 +1,73 @@ +* { + border: none; + font-size: 14px; + font-family: "Terminus" ; + min-height: 25px; +} + +window#waybar { + background: transparent; + margin: 5px; + } + +#custom-logo { + padding: 0 10px; + color: #5277c3; +} + +.modules-right { + padding-left: 5px; + border-radius: 15px 0 0 15px; + margin-top: 2px; + background: #000000; +} + +.modules-center { + padding: 0 15px; + margin-top: 2px; + border-radius: 15px 15px 15px 15px; + background: #000000; +} + +.modules-left { + border-radius: 0 15px 15px 0; + margin-top: 2px; + background: #000000; +} + +#custom-clipboard, +#pulseaudio, +#network, +#disk, +#memory, +#backlight, +#cpu, +#temperature, +#custom-weather, +#jack, +#tray, +#window, +#workspaces, +#clock { + padding: 0 5px; +} +#pulseaudio { + padding-top: 3px; +} + +#temperature.critical, +#pulseaudio.muted { + color: #FF0000; + padding-top: 0; +} + +#clock{ + color: #5fd1fa; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} diff --git a/src/user/modules/gui/modules/wm/hyprland/default.nix b/src/user/modules/gui/modules/wm/hyprland/default.nix index f498035..8fa61b9 100644 --- a/src/user/modules/gui/modules/wm/hyprland/default.nix +++ b/src/user/modules/gui/modules/wm/hyprland/default.nix @@ -10,7 +10,7 @@ let }; in -{ options.modules.user.gui.wm.hyprland = { enable = mkEnableOption "Enable hyprland wm module"; }; +{ options.modules.user.gui.wm.hyprland = { enable = mkEnableOption "Enable hyprland module"; }; config = mkIf cfg.enable { wayland.windowManager.hyprland = { enable = true; @@ -47,7 +47,7 @@ in "$mod, F, fullscreen" ", Print, exec, grim ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png" - "SHIFT, Print, exec, grim -g \"$slurp)\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png" + "SHIFT, Print, exec, grim -g \"$(slurp)\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png" "$mod&SHIFT, F, exec, alacritty -e sh -c 'EDITOR=nvim ranger'" #''$mod&SHIFT, Print, exec, sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png'"'' @@ -75,6 +75,20 @@ in "float, title:(Android Emulator)" ]; + general = { + layout = "master"; + border_size = 0; + }; + + decoration = { + rounding = 10; + }; + + master = { + drop_at_cursor = false; + new_is_master = false; + }; + input = { kb_layout = "us"; follow_mouse = 1; @@ -85,6 +99,11 @@ in env = [ "HYPRCURSOR_SIZE, 24" "GTK_THEME, Qogir" + + "LIBVA_DRIVER_NAME,nvidia" + "XDG_SESSION_TYPE,wayland" + "GBM_BACKEND,nvidia-drm" + "__GLX_VENDOR_LIBRARY_NAME,nvidia" ]; }; }; @@ -99,87 +118,46 @@ in ]; }; - home.file.".config/rofi" = { - source = ./config/rofi/config; - recursive = true; + home = { + file = { + ".config/rofi" = { + source = ./config/rofi/config; + recursive = true; + }; + ".config/waybar" = { + source = ./config/waybar; + recursive = true; + }; + }; + + packages = with pkgs; [ + pavucontrol + xdg-utils + wl-clipboard + cliphist + + dconf + + grim + jq + slurp + + ranger + highlight + + terminus-nerdfont + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + ]; + + sessionVariables = { + NIXOS_OZONE_WL = 1; + }; }; programs.waybar = { enable = true; - settings = [ - { - mainBar = { - font-family = "Terminus"; - font-size = 12; - background-color = "rgba(10, 14, 20, 1)"; - color = "#FFFFFF"; - - layer = "top"; - output = [ - "HDMI-A-1" - ]; - - position = "top"; - height = 10; - - modules-left = [ - "hyprland/workspaces" - "wlr/taskbar" - ]; - - modules-center = [ - "clock" - ]; - - modules-right = [ - "memory" - "network" - "tray" - ]; - - "hyprland/workspaces" = { - active-only = true; - format = "{name}"; - }; - - "wlr/taskbar" = { - format = "{icon}"; - icon_size = 14; - icon-theme = "Qogir"; - tooltip-format = "{title}"; - on-click = "minimize-raise"; - ignore-list = [ - "Alacritty" - "rofi" - ]; - rewrite = { - "Firefox Web Browser" = "Firefox"; - }; - }; - - "clock" = { - format = "%I:%M:%S %p | %m-%d-%Y"; - interval = 60; - }; - - "memory" = { - format = "RAM: {percentage}%"; - interval = 30; - }; - - "network" = { - format-disconnected = "󰜺"; - format-wifi = "󰖩{essid}({signalStrength}%)"; - format-ethernet = "󰈁{cidr}"; - }; - - "tray" = { - icon_size = 16; - spacing = 10; - }; - }; - } - ]; }; services.hyprpaper = { @@ -201,18 +179,27 @@ in gtk = { enable = true; theme = { - package = pkgs.juno-theme; name = "Juno-ocean"; + package = pkgs.juno-theme; }; iconTheme = { - package = pkgs.qogir-icon-theme; name = "Qogir"; + package = pkgs.qogir-icon-theme; + }; + gtk3.extraConfig = { + gtk-application-prefer-dark-theme = 1; + }; + gtk4.extraConfig = { + gtk-application-prefer-dark-theme = 1; }; }; qt = { enable = true; - style.package = pkgs.juno-theme; + style = { + name = "juno-ocean"; + package = pkgs.juno-theme; + }; platformTheme.name = "gtk"; }; @@ -224,25 +211,6 @@ in config.common.default = "*"; }; - home.packages = with pkgs; [ - pavucontrol - xdg-utils - wl-clipboard - dconf - - grim - jq - slurp - - ranger - highlight - - terminus-nerdfont - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - ]; - programs = { imv.enable = true; };