Enabled hyprland with proprietary nvidia support

This commit is contained in:
Bryan Ramos 2024-06-08 23:28:44 -04:00
parent d350af642f
commit ca789d4eea
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8
11 changed files with 340 additions and 279 deletions

View file

@ -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;
}

View file

@ -34,7 +34,7 @@
};
gui = {
wm.sway.enable = true;
wm.hyprland.enable = true;
alacritty.enable = true;
browsers.enable = true;

View file

@ -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 = [

View file

@ -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; };
};
};
}

View file

@ -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;
};
}

View file

@ -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": "<span color='#ffffff'>{icon}</span>",
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "",
"6": "",
"active": "",
"default": ""
},
"persistent-workspaces": {
"*": [ 2, 3, 4, 5, 6 ]
}
},
"custom/weather": {
"format": "<span color='#ffffff'>{}</span>",
"return-type": "json",
"exec": "~/.config/waybar/scripts/weather.sh",
"interval": 10,
},
"custom/bitcoin": {
"format": "<span color='#ef8e19'>󰠓 </span><span color='#ffffff'>:{}</span>",
"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<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"calendar-weeks-pos": "right",
"today-format": "<span color='#7645AD'><b><u>{}</u></b></span>",
"format-calendar": "<span color='#aeaeae'><b>{}</b></span>",
"format-calendar-weeks": "<span color='#aeaeae'><b>W{:%V}</b></span>",
"format-calendar-weekdays": "<span color='#aeaeae'><b>{}</b></span>"
},
"network": {
"format-wifi": "<span color='#ffffff'> </span>",
"format-ethernet":"<span color='#ffffff'>󰌘</span>",
"format-disconnected": "<span class='#e11e2d'></span>",
"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": "<span color='#ffd808'> </span><span color='#ffffff'>:{usage}%</span>",
"min-length": 6,
"max-length": 6,
"format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"],
},
"memory": {
"format": "<span color='#cc63ff'>󱐋</span><span color='#ffffff'>:{percentage}%</span>"
},
"temperature": {
"format": "<span color='#99c3ff'>󱩱 </span><span color='#ffffff'>:{temperatureC}°C</span>",
"format-critical": "<span color='#fd4400'>󰈸</span><span color='#ffffff'>:{temperatureC}°C</span>",
"interval": 1,
"critical-threshold": 80,
"on-click": "alacritty -e btop",
},
"pulseaudio": {
"format": "<span color='#ffffff'>{icon}</span>",
"format-bluetooth":"󰂰",
"format-muted": "<span font='12'></span>",
"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
},
}

View file

@ -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 = "<span color=\"#FF0000\">󰜺</span>";
format-wifi = "<span color=\"##00FF00\">󰖩</span>{essid}({signalStrength}%)";
format-ethernet = "<span color=\"##00FF00\">󰈁</span>{cidr}";
};
"tray" = {
icon_size = 16;
spacing = 10;
};
};
}
];
}

View file

@ -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\": \"<tt>$tooltip</tt>\", \"class\": \"weather\"}"
fi

View file

@ -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;
}
}

View file

@ -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 = "<span color=\"#FF0000\">󰜺</span>";
format-wifi = "<span color=\"##00FF00\">󰖩</span>{essid}({signalStrength}%)";
format-ethernet = "<span color=\"##00FF00\">󰈁</span>{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;
};