diff --git a/flake.nix b/flake.nix index 67f1999..b357221 100755 --- a/flake.nix +++ b/flake.nix @@ -42,28 +42,13 @@ flake = false; }; - wlroots-git = { - url = "gitlab:wlroots/wlroots/0.16.0?host=gitlab.freedesktop.org"; - flake = false; - }; - - sway-git = { - url = "github:swaywm/sway/v1.8"; - flake = false; - }; - - gamescope-git = { - url = "github:Plagman/gamescope"; - flake = false; - }; - xorg-git = { url = "gitlab:xorg/xserver?host=gitlab.freedesktop.org"; flake = false; }; mesa-git = { - url = "gitlab:mesa/mesa?host=gitlab.freedesktop.org"; + url = "gitlab:mesa/mesa/mesa-22.3.2?host=gitlab.freedesktop.org"; flake = false; }; @@ -72,6 +57,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + hyprland = { + url = "github:hyprwm/hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + waybar = { url = "github:alexays/waybar"; flake = false; @@ -98,39 +88,17 @@ fonts = [ "JetBrainsMono" "IBMPlexMono" ]; }; - wayland-protcols-git = prev.wayland-protocols.overrideAttrs (old: { - version = "git"; - src = inputs.wayland-protcols-git; - }); - - wlroots-git = (prev.wlroots.overrideAttrs (old: { - version = "0.16.0"; - src = inputs.wlroots-git; - nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.cmake pkgs.hwdata ]; - postPatch = '' - substituteInPlace backend/drm/meson.build \ - --replace "/usr/share/hwdata/pnp.ids" "${pkgs.hwdata}/share/hwdata/pnp.ids" - ''; - })).override { - wayland-protocols = wayland-protcols-git; - }; - - sway-unwrapped = (prev.sway-unwrapped.overrideAttrs (old: { - version = "1.8"; - buildInputs = old.buildInputs ++ [ prev.xorg.xcbutilwm prev.pcre2 ]; - nativeBuildInputs = old.nativeBuildInputs ++ [ prev.cmake ]; - src = inputs.sway-git; - })).override { - wayland-protocols = wayland-protcols-git; - wlroots = wlroots-git; - }; - - waybar = (prev.waybar.overrideAttrs (old: { + waybar = prev.waybar.overrideAttrs (old: { version = "git"; src = inputs.waybar; - })).override { - wlroots = wlroots-git; - }; + + preConfigure = '' + sed -i 's/zext_workspace_handle_v1_activate(workspace_handle_);/const std::string command = "hyprctl dispatch workspace " + name_;\n\tsystem(command.c_str());/g' src/modules/wlr/workspace_manager.cpp + ''; + + mesonFlags = old.mesonFlags ++ [ "-Dexperimental=true" ]; + + }); xwayland = prev.xwayland.overrideAttrs (old: { version = "git"; @@ -150,7 +118,6 @@ pkgs.libkrb5 pkgs.mangohud pkgs.mpg123 - pkgs.steamtinkerlaunch ]; extraLibraries = pkgs: [ @@ -159,15 +126,10 @@ ]; }; - # gamescope = prev.gamescope.overrideAttrs (old: { - # version = "git"; - # src = inputs.gamescope-git; - # }); - mesa-git = (prev.mesa.overrideAttrs (old: { version = "git"; src = inputs.mesa-git; - buildInputs = old.buildInputs ++ [ pkgs.glslang pkgs.vulkan-loader ]; + buildInputs = old.buildInputs ++ [ pkgs.llvmPackages.libclang pkgs.glslang pkgs.vulkan-loader ]; patches = [ ./pkgs/patches/mesa-git/opencl.patch ./pkgs/patches/mesa-git/disk_cache-include-dri-driver-path-in-cache-key.patch @@ -180,6 +142,10 @@ vulkanDrivers = [ "amd" ]; enableGalliumNine = false; # Replaced by DXVK }; + + customedid = pkgs.callPackage ./pkgs/custom-edid { }; + wxedid = pkgs.callPackage ./pkgs/wxedid { }; + }; nixosConfigurations.terra = nixpkgs.lib.nixosSystem { diff --git a/pkgs/custom-edid/default.nix b/pkgs/custom-edid/default.nix new file mode 100644 index 0000000..9bf365c --- /dev/null +++ b/pkgs/custom-edid/default.nix @@ -0,0 +1,18 @@ +{ stdenvNoCC, lib }: + +stdenvNoCC.mkDerivation rec { + pname = "edid-main-monitor"; + version = "1"; + + edid = ./edid.bin; + + dontFixup = true; + + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p $out/lib/firmware/edid + cp ${edid} $out/lib/firmware/edid/edid-EX2780Q.bin + ''; +} + diff --git a/pkgs/custom-edid/edid.bin b/pkgs/custom-edid/edid.bin new file mode 100644 index 0000000..4da44de Binary files /dev/null and b/pkgs/custom-edid/edid.bin differ diff --git a/pkgs/custom-wlscripts/default.nix b/pkgs/custom-wlscripts/default.nix new file mode 100644 index 0000000..316cb0a --- /dev/null +++ b/pkgs/custom-wlscripts/default.nix @@ -0,0 +1,14 @@ +{ config, pkgs, lib, ... }: +let + wobsock = "/tmp/wob-volume.fifo"; +in +stdenvNoCC.mkDerivation rec { + pname = "custom-wlscripts"; + version = "1"; + + phases = [ "installPhase" ]; + + + installPhase = '' +} + diff --git a/pkgs/wxedid/default.nix b/pkgs/wxedid/default.nix new file mode 100644 index 0000000..537ef54 --- /dev/null +++ b/pkgs/wxedid/default.nix @@ -0,0 +1,16 @@ +{ lib, stdenv, fetchurl, wxGTK32 }: + +stdenv.mkDerivation rec { + pname = "wxedid"; + version = "0.0.27"; + src = fetchurl { + url = "https://downloads.sourceforge.net/${pname}/${pname}-${version}.tar.gz"; + sha256 = "KBIGrzsJ40TEsz+kJQZi9BPPFPITfVRrTlc1FYqdFfo="; + }; + + postPatch = '' + patchShebangs --build src/rcode/rcd_autogen + ''; + + buildInputs = [ wxGTK32 ]; +} diff --git a/system/configuration.nix b/system/configuration.nix index 39e9cd5..ece7d77 100755 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -6,13 +6,19 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + inputs.hyprland.nixosModules.default ]; nixpkgs.config.allowUnfree = true; + hardware.firmware = [ pkgs.customedid ]; + boot = { kernelParams = - [ "amdgpu.ppfeaturemask=0xffffffff" ]; + [ + "amdgpu.ppfeaturemask=0xffffffff" + "drm.edid_firmware=DP-1:edid/edid-EX2780Q.bin" + ]; loader = { efi = { @@ -34,7 +40,7 @@ }; }; - initrd.availableKernelModules = [ "amdgpu" ]; + # initrd.availableKernelModules=sd [ "amdgpu" ]; kernelPackages = pkgs.linuxPackages_latest; kernelModules = [ "i2c-dev" "i2c-piix4" ]; }; @@ -75,8 +81,8 @@ hardware.opengl = { enable = true; - package = pkgs.mesa-git.drivers; - package32 = pkgs.pkgsi686Linux.mesa-git.drivers; + #package = pkgs.mesa-git.drivers; + #package32 = pkgs.pkgsi686Linux.mesa-git.drivers; extraPackages = [ pkgs.libvdpau-va-gl ]; driSupport = true; @@ -141,6 +147,8 @@ ]; }; + programs.hyprland.enable = true; + # Define a user account. Don't forget to set a password with ‘passwd’. users.users.manuel = { isNormalUser = true; diff --git a/user/configs/fish/fish.nix b/user/configs/fish/fish.nix index 58ce799..80572a4 100755 --- a/user/configs/fish/fish.nix +++ b/user/configs/fish/fish.nix @@ -68,7 +68,7 @@ ''; }; shellAliases = { - nf = "${pkgs.neofetch}/bin/neofetch"; + nf = "${pkgs.pfetch}/bin/pfetch"; r = "${pkgs.nnn}/bin/nnn"; }; }; diff --git a/user/configs/wayland/hyprland.nix b/user/configs/wayland/hyprland.nix new file mode 100644 index 0000000..45aafb8 --- /dev/null +++ b/user/configs/wayland/hyprland.nix @@ -0,0 +1,174 @@ +{ config, pkgs, lib, inputs, ... }: +let + colors = config.colorScheme.colors; + wobsock = "/tmp/wob-vol.fifo"; + + modKey = "SUPER"; + + leftMonitor = "HDMI-A-1"; + rightMonitor = "DP-1"; + + wallpaper = "/mnt/hdd/Wallpapers/florest-stair2.jpg"; + + + wob-voldaemon = pkgs.writeShellScriptBin "wob-volumedaemon.sh" '' + if pgrep "wob"; then + killall wob &> /dev/null + fi + + if [[ -e "${wobsock}" ]]; then + rm "${wobsock}" + fi + + mkfifo "${wobsock}" + tail -f "${wobsock}" | ${pkgs.wob}/bin/wob & + echo "wob: started" + ''; + + passmenu = pkgs.writeShellScriptBin "passmenu.sh" '' + shopt -s nullglob globstar + + prefix=''${PASSWORD_STORE_DIR-~/.password-store} + password_files=( "$prefix"/**/*.gpg ) + password_files=( "''${password_files[@]#"$prefix"/}" ) + password_files=( "''${password_files[@]%.gpg}" ) + + password=$(printf '%s\n' "''${password_files[@]}" | ${pkgs.fuzzel}/bin/fuzzel -d -p "pass: " "$@") + + [[ -n $password ]] || exit + + pass show -c "$password" 2>/dev/null + ''; + + xwaylandSetPrimary = pkgs.writeShellScriptBin "xwayland-setprimary.sh" '' + DSP=$(${pkgs.xorg.xrandr}/bin/xrandr | awk '/2560x1440/ {print $1}' | head -n 1) + + ${pkgs.xorg.xrandr}/bin/xrandr --output "$DSP" --primary + echo "Xwayland: $DSP - Primary monitor set" + ''; + + killprocess = pkgs.writeShellScriptBin "killprocess.sh" '' + ps -x -o pid=,comm= | column -t -o " " | ${pkgs.fuzzel}/bin/fuzzel -d -p "kill process: " | awk '{print $1}' | uniq | xargs -r kill -9 + ''; +in + +{ + imports = [ + inputs.hyprland.homeManagerModules.default + ./waybar.nix + ./foot.nix + ./wob.nix + ./fuzzel.nix + ./mako.nix + ]; + + wayland.windowManager.hyprland = { + enable = true; + extraConfig = '' + monitor=${leftMonitor}, 1920x1080@60, 0x0, 1 + monitor=${rightMonitor}, 2560x1440@144, 1920x0, 1 + + input { + kb_layout = us + kb_variant = altgr-intl + + #mouse + accel_profile = flat + follow_mouse = 1 + } + + general { + gaps_in = 10 + border_size = 2 + + col.active_border = rgba(${colors.base0F}FF) + col.inactive_border = rgba(${colors.base00}FF) + } + + dwindle { + pseudotile = yes + preserve_split = yes + } + + master { + new_is_master = true + } + + misc { + no_vfr = no + } + + exec-once = ${pkgs.waybar}/bin/waybar + exec-once = ${pkgs.swaybg}/bin/swaybg -i ${wallpaper} -m fill + + exec-once = ${pkgs.openrgb}/bin/openrgb --server --profile autorun.orp + exec-once = ${pkgs.networkmanagerapplet}/bin/nm-applet --indicator + exec-once = ${pkgs.blueman}/bin/blueman-applet + + exec = ${wob-voldaemon}/bin/wob-volumedaemon.sh; + exec = ${xwaylandSetPrimary}/bin/xwayland-setprimary.sh + + #keybinds + bind = ${modKey}, 1, workspace, 1 + bind = ${modKey}, 2, workspace, 2 + bind = ${modKey}, 3, workspace, 3 + bind = ${modKey}, 4, workspace, 4 + bind = ${modKey}, 5, workspace, 5 + bind = ${modKey}, 6, workspace, 6 + + bind = ${modKey} SHIFT, 1, movetoworkspace, 1 + bind = ${modKey} SHIFT, 2, movetoworkspace, 2 + bind = ${modKey} SHIFT, 3, movetoworkspace, 3 + bind = ${modKey} SHIFT, 4, movetoworkspace, 4 + bind = ${modKey} SHIFT, 5, movetoworkspace, 5 + bind = ${modKey} SHIFT, 6, movetoworkspace, 6 + + wsbind = 1,${rightMonitor} + wsbind = 2,${rightMonitor} + wsbind = 3,${rightMonitor} + + wsbind = 4,${leftMonitor} + wsbind = 5,${leftMonitor} + wsbind = 6,${leftMonitor} + + bindm = ${modKey}, mouse:272, movewindow + bindm = ${modKey}, mouse:273, resizewindow + + bind = ${modKey}, P, pseudo, # dwindle + bind = ${modKey}, J, togglesplit, # dwindle + bind = ${modKey} SHIFT, Space, togglefloating + bind = ${modKey}, F, fullscreen + + bind = ${modKey} SHIFT, Q, killactive + bind = ${modKey}, d, exec, ${pkgs.fuzzel}/bin/fuzzel + + bind = ${modKey}, q, exec, ${pkgs.firefox}/bin/firefox + + bind = ${modKey}, Return, exec, foot + + bind = , XF86AudioRaiseVolume, exec, ${pkgs.pamixer}/bin/pamixer -i 10 --get-volume > ${wobsock} + bind = , XF86AudioLowerVolume, exec, ${pkgs.pamixer}/bin/pamixer -d 10 --get-volume > ${wobsock} + + bind = CTRL, Space, exec, ${pkgs.mako}/bin/makoctl dismiss + bind = CTRL, grave, exec, ${pkgs.mako}/bin/makoctl restore + + bind = ${modKey} SHIFT, p, exec, ${passmenu}/bin/passmenu.sh + bind = ${modKey} SHIFT, o, exec, ${killprocess}/bin/killprocess.sh + + bind = MOD5, F9, exec, ${pkgs.mpc-cli}/bin/mpc stop + bind = MOD5, F10, exec, ${pkgs.mpc-cli}/bin/mpc prev + bind = MOD5, F11, exec, ${pkgs.mpc-cli}/bin/mpc toggle + bind = MOD5, F12, exec, ${pkgs.mpc-cli}/bin/mpc next + + bind = , Print, exec, ${pkgs.sway-contrib.grimshot}/bin/grimshot -c --notify copy screen + bind = ${modKey}, Print, exec, ${pkgs.sway-contrib.grimshot}/bin/grimshot -c --notify copy active + bind = ${modKey} SHIFT, Print, exec, ${pkgs.sway-contrib.grimshot}/bin/grimshot -c --notify copy area + + bind = ${modKey} SHIFT, C, exec, hyprctl reload + + ''; + + }; + home.packages = [ pkgs.wl-clipboard ]; +} + diff --git a/user/configs/wayland/waybar.nix b/user/configs/wayland/waybar.nix index 6e5ca42..41bf97c 100755 --- a/user/configs/wayland/waybar.nix +++ b/user/configs/wayland/waybar.nix @@ -29,8 +29,8 @@ in position = "top"; height = 32; - modules-left = [ "custom/blank" "sway/workspaces" "sway/mode" ]; - modules-center = [ "sway/window" ]; + modules-left = [ "custom/blank" "wlr/workspaces" ]; + modules-center = [ "hyprland/window" ]; modules-right = [ "custom/ds-battery" "pulseaudio" @@ -47,6 +47,16 @@ in icon-size = 16; }; + "wlr/workspaces" = { + on-click = "activate"; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; + }; + + "hyprland/window" = { + separate-outputs = true; + }; + "clock" = { format = "{:%a %d. %B %H:%M}"; }; @@ -133,7 +143,7 @@ in padding: 0 5px; } - #workspaces button.focused { + #workspaces button.active { border-radius: 0; color: @foreground; background: @box-bg; diff --git a/user/home.nix b/user/home.nix index 34a2436..4cb9512 100755 --- a/user/home.nix +++ b/user/home.nix @@ -4,7 +4,8 @@ nix-colors.homeManagerModule ./configs/beets/beets.nix ./configs/kakoune/kakoune.nix - ./configs/wayland/sway.nix + ./configs/wayland/hyprland.nix + #./configs/wayland/sway.nix ./configs/fish/fish.nix ./configs/mpd/mpd.nix ./configs/mpv/mpv.nix @@ -20,12 +21,13 @@ home.homeDirectory = "/home/manuel"; home.packages = with pkgs; [ appimage-run + bottom + calcurse discord-canary gamescope gimp gnome.file-roller gnome.gvfs - gnome.nautilus lutris mesa-demos mesa-demos @@ -47,6 +49,7 @@ vulkan-tools vulkan-validation-layers wineWowPackages.stagingFull + wxedid xdg-utils xivlauncher ]; @@ -54,7 +57,7 @@ home.sessionVariables = { EDITOR = "kak"; WINEDLLOVERRIDES = "winemenubuilder.exe=d"; - RADV_PERFTEST = "gpl"; + #RADV_PERFTEST = "gpl"; }; colorScheme = nix-colors.colorSchemes.gruvbox-dark-medium;