From b9ae0a5f1817e0e11965b7fae323dddc97565a74 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Mon, 15 Jan 2024 14:40:08 -0300 Subject: [PATCH] fix: discord screen share FINALLY, MY FUCKING GOD THIS IS WORKING --- flake.lock | 287 +++++++++++++++++++-- flake.nix | 14 + hosts/desktop/shared-configuration.nix | 5 +- hosts/desktop/shared-home.nix | 3 +- modules/home-manager/programs/hyprland.nix | 4 + modules/nixos/config/host.nix | 1 + 6 files changed, 292 insertions(+), 22 deletions(-) diff --git a/flake.lock b/flake.lock index 7560644..3d25273 100644 --- a/flake.lock +++ b/flake.lock @@ -76,11 +76,11 @@ ] }, "locked": { - "lastModified": 1704100519, - "narHash": "sha256-SgZC3cxquvwTN07vrYYT9ZkfvuhS5Y1k1F4+AMsuflc=", + "lastModified": 1705335923, + "narHash": "sha256-jRyp+a89Y7Cb2V/NyIJpgu5gsND419bY16omCZWy+jc=", "owner": "nix-community", "repo": "home-manager", - "rev": "6e91c5df192395753d8e6d55a0352109cb559790", + "rev": "b989db5900df4bd1a786f8afd8063dae09d89a8c", "type": "github" }, "original": { @@ -89,6 +89,121 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs", + "systems": "systems", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1705332646, + "narHash": "sha256-D/7HUGGYBZHn8Zjs8Agf2i8mL64uqksKEjXz1QAd80c=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "3c964a9fdc220250a85b1c498e5b6fad9390272f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprland-protocols_2": { + "inputs": { + "nixpkgs": [ + "xdg-desktop-portal-hyprland", + "nixpkgs" + ], + "systems": [ + "xdg-desktop-portal-hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": [ + "hyprland", + "xdph", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704287638, + "narHash": "sha256-TuRXJGwtK440AXQNl5eiqmQqY4LZ/9+z/R7xC0ie3iA=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "6624f2bb66d4d27975766e81f77174adbe58ec97", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlang_2": { + "inputs": { + "nixpkgs": [ + "xdg-desktop-portal-hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704287638, + "narHash": "sha256-TuRXJGwtK440AXQNl5eiqmQqY4LZ/9+z/R7xC0ie3iA=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "6624f2bb66d4d27975766e81f77174adbe58ec97", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, "nix-colors": { "inputs": { "base16-schemes": "base16-schemes", @@ -115,11 +230,11 @@ ] }, "locked": { - "lastModified": 1704596958, - "narHash": "sha256-BK3Ohsz7m8X6qVKFxDtr8KVcHipfr5hYE9PDIJevHbQ=", + "lastModified": 1705282324, + "narHash": "sha256-LnURMA7yCM5t7et9O2+2YfGQh0FKAfE5GyahNDDzJVM=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "f46800ac5a6e9f892fe36e50821c5d85794ecc62", + "rev": "49aaeecf41ae0a0944e2c627cb515bcde428a1d1", "type": "github" }, "original": { @@ -130,15 +245,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703961334, - "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", - "owner": "nixos", + "lastModified": 1705133751, + "narHash": "sha256-rCIsyE80jgiOU78gCWN3A0wE0tR2GI5nH6MlS+HaaSQ=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", + "rev": "9b19f5e77dd906cb52dade0b7bd280339d2a1f3d", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -161,11 +276,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1704290814, - "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=", + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", "type": "github" }, "original": { @@ -175,16 +290,50 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1705133751, + "narHash": "sha256-rCIsyE80jgiOU78gCWN3A0wE0tR2GI5nH6MlS+HaaSQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9b19f5e77dd906cb52dade0b7bd280339d2a1f3d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1703961334, + "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "firefox-addons": "firefox-addons", "flatpaks": "flatpaks", "home-manager": "home-manager", + "hyprland": "hyprland", "nix-colors": "nix-colors", "nix-index-database": "nix-index-database", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "sops-nix": "sops-nix", - "tmux-plugin-manager": "tmux-plugin-manager" + "tmux-plugin-manager": "tmux-plugin-manager", + "xdg-desktop-portal-hyprland": "xdg-desktop-portal-hyprland" } }, "sops-nix": { @@ -195,11 +344,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1704908274, - "narHash": "sha256-74W9Yyomv3COGRmKi8zvyA5tL2KLiVkBeaYmYLjXyOw=", + "lastModified": 1705201153, + "narHash": "sha256-y0/a4IMDZrc7lAkR7Gcm5R3W2iCBiARHnYZe6vkmiNE=", "owner": "Mic92", "repo": "sops-nix", - "rev": "c0b3a5af90fae3ba95645bbf85d2b64880addd76", + "rev": "70dd0d521f7849338e487a219c1a07c429a66d77", "type": "github" }, "original": { @@ -208,6 +357,36 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, "tmux-plugin-manager": { "flake": false, "locked": { @@ -223,6 +402,76 @@ "repo": "tpm", "type": "github" } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1703963193, + "narHash": "sha256-ke8drv6PTrdQDruWbajrRJffP9A9PU6FRyjJGNZRTs4=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "f81c3d93cd6f61b20ae784297679283438def8df", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "f81c3d93cd6f61b20ae784297679283438def8df", + "type": "gitlab" + } + }, + "xdg-desktop-portal-hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols_2", + "hyprlang": "hyprlang_2", + "nixpkgs": "nixpkgs_3", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1704659450, + "narHash": "sha256-3lyoUVtUWz1LuxbltAtkJSK2IlVXmKhxCRU2/0PYCms=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "6a5de92769d5b7038134044053f90e7458f6a197", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": "hyprlang", + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1704659450, + "narHash": "sha256-3lyoUVtUWz1LuxbltAtkJSK2IlVXmKhxCRU2/0PYCms=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "6a5de92769d5b7038134044053f90e7458f6a197", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 04171e0..9d83074 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,20 @@ url = "github:tmux-plugins/tpm"; flake = false; }; + + # THANK YOU SO MUCH RadovanSk!! + # https://github.com/NixOS/nixpkgs/issues/277230#issuecomment-1878092466 + hyprland.url = "github:hyprwm/Hyprland"; + xdg-desktop-portal-hyprland.url = "github:hyprwm/xdg-desktop-portal-hyprland"; + /* + Note to self: + The last commit with working screen share, as the time of writing this, was + https://github.com/hyprwm/xdg-desktop-portal-hyprland/commit/6a5de92769d5b7038134044053f90e7458f6a197 + https://github.com/hyprwm/Hyprland/commit/3c964a9fdc220250a85b1c498e5b6fad9390272f + so if needed, you can always roll-back. + + Fuck discord. + */ }; outputs = { self, nixpkgs, home-manager, ... }@inputs: diff --git a/hosts/desktop/shared-configuration.nix b/hosts/desktop/shared-configuration.nix index ec9aa84..e217767 100644 --- a/hosts/desktop/shared-configuration.nix +++ b/hosts/desktop/shared-configuration.nix @@ -24,11 +24,12 @@ programs.hyprland = { enable = true; xwayland.enable = true; + package = inputs.hyprland.packages."${pkgs.system}".hyprland; + portalPackage = inputs.xdg-desktop-portal-hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland; }; xdg.portal.enable = true; xdg.portal.extraPortals = with pkgs; [ - xdg-desktop-portal-hyprland xdg-desktop-portal-kde ]; @@ -38,6 +39,8 @@ }; environment.systemPackages = with pkgs; [ + inputs.xdg-desktop-portal-hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland + inputs.hyprland.packages."${pkgs.system}".hyprland electron_28 wlroots kitty diff --git a/hosts/desktop/shared-home.nix b/hosts/desktop/shared-home.nix index 91864d1..eb2f473 100644 --- a/hosts/desktop/shared-home.nix +++ b/hosts/desktop/shared-home.nix @@ -42,7 +42,6 @@ services.flatpak.packages = [ "nz.mega.MEGAsync" "md.obsidian.Obsidian" - # "dev.vencord.Vesktop" ]; # services.flatpak.overrides = { }; @@ -50,7 +49,7 @@ nixpkgs.config.allowUnfreePredicate = _: true; home.packages = with pkgs; [ ## Programs - vesktop + webcord-vencord # (pkgs.writeShellScriptBin "my-hello" '' # echo "Hello, ${config.home.username}!" diff --git a/modules/home-manager/programs/hyprland.nix b/modules/home-manager/programs/hyprland.nix index 5f1c8f5..d89c460 100644 --- a/modules/home-manager/programs/hyprland.nix +++ b/modules/home-manager/programs/hyprland.nix @@ -124,6 +124,10 @@ in }; config = lib.mkIf cfg.enable { wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.package = inputs.hyprland.packages."${pkgs.system}".hyprland; + + wayland.windowManager.hyprland.xwayland.enable = true; + wayland.windowManager.hyprland.systemd.enable = true; wayland.windowManager.hyprland.settings = lib.mkMerge [ # Sets monitor variables ("$name" = "id") so it can be used in rules later diff --git a/modules/nixos/config/host.nix b/modules/nixos/config/host.nix index 6176011..d8c02c2 100644 --- a/modules/nixos/config/host.nix +++ b/modules/nixos/config/host.nix @@ -57,6 +57,7 @@ in alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; + wireplumber.enable = true; #jack.enable = true; };