From f246c317941baf5299c5795fe4bcf717d9b5432e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Thu, 19 Sep 2024 11:09:23 -0300 Subject: [PATCH 1/4] Revert "sway: disable vrr" This reverts commit 752f029bce075d605d22e1a0b40c016801467e13. --- scripts/default.nix | 1 + scripts/vrr-fullscreen | 28 ++++++++++++++++++++++++++++ user/sway/default.nix | 17 ++++++++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 scripts/vrr-fullscreen diff --git a/scripts/default.nix b/scripts/default.nix index 0e88436..1e3290e 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -129,6 +129,7 @@ libinput libratbag ]; + vrr-fullscreen = [ ]; } // lib.mapAttrs importScript { wdmenu = ./wdmenu.nix; diff --git a/scripts/vrr-fullscreen b/scripts/vrr-fullscreen new file mode 100755 index 0000000..8413923 --- /dev/null +++ b/scripts/vrr-fullscreen @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# List of supported outputs for VRR +output_vrr_whitelist=( + "DP-1" + "DP-2" +) + +# Toggle VRR for fullscreened apps in prespecified displays to avoid stutters while in desktop +swaymsg -t subscribe -m '[ "window" ]' | while read window_json; do + window_event=$(echo ${window_json} | jq -r '.change') + + # Process only focus change and fullscreen toggle + if [[ $window_event = "focus" || $window_event = "fullscreen_mode" ]]; then + output_json=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused == true)') + output_name=$(echo ${output_json} | jq -r '.name') + + # Use only VRR in whitelisted outputs + if [[ ${output_vrr_whitelist[*]} =~ ${output_name} ]]; then + output_vrr_status=$(echo ${output_json} | jq -r '.adaptive_sync_status') + window_fullscreen_status=$(echo ${window_json} | jq -r '.container.fullscreen_mode') + + # Only update output if nesseccary to avoid flickering + [[ $output_vrr_status = "disabled" && $window_fullscreen_status = "1" ]] && swaymsg output "${output_name}" adaptive_sync 1 + [[ $output_vrr_status = "enabled" && $window_fullscreen_status = "0" ]] && swaymsg output "${output_name}" adaptive_sync 0 + fi + fi +done diff --git a/user/sway/default.nix b/user/sway/default.nix index 42e26af..2a6dc70 100644 --- a/user/sway/default.nix +++ b/user/sway/default.nix @@ -69,9 +69,9 @@ in }; output = { "*" = { + adaptive_sync = "off"; bg = "${theme.background} fill"; mode = "1920x1080@144.000Hz"; - adaptive_sync = "on"; }; }; fonts = { @@ -122,6 +122,21 @@ in indicator = true; }; + systemd.user.services.vrr-fullscreen = { + Unit = { + Description = "Enable VRR for fullscreen windows"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${lib.getExe pkgs.vrr-fullscreen}"; + Restart = "on-failure"; + }; + Install = { + WantedBy = [ "sway-session.target" ]; + }; + }; + services.gpg-agent.pinentryPackage = pkgs.pinentry-all; xdg.configFile."OpenTabletDriver/settings.json".source = ./open-tablet-driver.json; From 9828e1366d35b046f40af30118e2224a4b3aaa05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Fri, 30 Aug 2024 19:25:36 -0300 Subject: [PATCH 2/4] monolith: switch to latest kernel --- hosts/monolith/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hosts/monolith/default.nix b/hosts/monolith/default.nix index b45a935..3350e0d 100644 --- a/hosts/monolith/default.nix +++ b/hosts/monolith/default.nix @@ -36,6 +36,8 @@ in hardware.opentabletdriver.enable = true; + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower ]; boot.initrd.kernelModules = [ "amdgpu" ]; boot.kernelModules = [ From 2a4f056aaacd3913be79044ab8d59f14a17a35f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Wed, 25 Sep 2024 22:24:46 -0300 Subject: [PATCH 3/4] flake: add unstable --- flake.lock | 16 ++++++++++++++++ flake.nix | 7 ++++++- overlays/default.nix | 5 +++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index 689e9af..a76aa8d 100644 --- a/flake.lock +++ b/flake.lock @@ -469,6 +469,21 @@ "type": "indirect" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1726937504, + "narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9357f4f23713673f310988025d9dc261c20e70c6", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, "plymouth-themes": { "flake": false, "locked": { @@ -512,6 +527,7 @@ "nix-index-database": "nix-index-database", "nixos-mailserver": "nixos-mailserver", "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", "plymouth-themes": "plymouth-themes", "ranger-icons": "ranger-icons", "tlauncher": "tlauncher", diff --git a/flake.nix b/flake.nix index 23ece59..ec2011f 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,8 @@ description = "My system config"; inputs = { nixpkgs.url = "nixpkgs/nixos-24.05"; + nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager/release-24.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; @@ -157,7 +159,10 @@ }; phantom = lib.nixosSystem { inherit system specialArgs; - modules = [ ./hosts/phantom ]; + modules = [ + { nixpkgs.pkgs = pkgs; } + ./hosts/phantom + ]; }; }; diff --git a/overlays/default.nix b/overlays/default.nix index 2ac2ae1..8886897 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -2,6 +2,7 @@ rec { all = [ scripts + unstable themes new-packages patches @@ -11,6 +12,10 @@ rec { scripts = (import ../scripts); + unstable = final: prev: { + unstable = import inputs.nixpkgs-unstable { inherit (final) system config; }; + }; + themes = ( final: prev: { papirus_red = (final.papirus-icon-theme.override { color = "red"; }); From 5062c28d4fbbb7c8219e8640540a44423ae9a28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Wed, 25 Sep 2024 22:08:10 -0300 Subject: [PATCH 4/4] invidious: install many helpers --- hosts/phantom/invidious.nix | 34 +++++++++++++++++++++++--- secrets/phantom-invidious-settings.age | 16 ++++++++++++ secrets/secrets.nix | 1 + 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 secrets/phantom-invidious-settings.age diff --git a/hosts/phantom/invidious.nix b/hosts/phantom/invidious.nix index 8c1e0f6..60c1dca 100644 --- a/hosts/phantom/invidious.nix +++ b/hosts/phantom/invidious.nix @@ -1,12 +1,40 @@ { + inputs, + pkgs, + config, + ... +}: +{ + # Replace with unstable, since 24.05 does not have sig-helper + disabledModules = [ "services/web-apps/invidious.nix" ]; + imports = [ (inputs.nixpkgs-unstable + "/nixos/modules/services/web-apps/invidious.nix") ]; + services.invidious = { enable = true; domain = "invidious.lelgenio.com"; nginx.enable = true; port = 10601; - settings.db = { - user = "invidious"; - dbname = "invidious"; + http3-ytproxy.enable = true; + sig-helper = { + enable = true; + package = pkgs.unstable.inv-sig-helper; + }; + # { + # "visitor_data": "...", + # "po_token": "..." + # } + extraSettingsFile = config.age.secrets.phantom-invidious-settings.path; + settings = { + force_resolve = "ipv6"; + db = { + user = "invidious"; + dbname = "invidious"; + }; }; }; + + age.secrets.phantom-invidious-settings = { + file = ../../secrets/phantom-invidious-settings.age; + mode = "666"; + }; } diff --git a/secrets/phantom-invidious-settings.age b/secrets/phantom-invidious-settings.age new file mode 100644 index 0000000..6ca9077 --- /dev/null +++ b/secrets/phantom-invidious-settings.age @@ -0,0 +1,16 @@ +age-encryption.org/v1 +-> ssh-rsa BwwxHg +iTcgtxF1IxopbtF+aw7V8IQfH7tWiMk9lE/eWlVHVjeaRvER5W6Y3xZNOFCjtbqY +VwEyV6ibfZ4GJt1jRu2icEH/AnLUJFFGQnxu/K/rtoZ3tqSIk9WCBv3aPo4oZRiU +uaaxi2gD8qo1RLyl/Ij7Djw4i/isUOO1EON5sgx1d39k6qUD4Mak0DSU4EtGdTsr +OaxDAc0kAxhxZQOUH/QlKa0HLonaFcy1LHqvttOcw3UZuZnaYfZiPlcqe3USS9cm +96aIC5cS9pHr4JFrqRYvfpla2TY5jlCB/xBGw3KjGEIQoBPXSsJZA6BCMZyp00++ +tdfS2aomt9HFmb1wZDS0jWAxkVF6nXXBbolFVih+58h0nYLljtHIQ3SizRoXY459 +x3JE9NReHp2OO3SlIeO03Kv8YMBvj7nSSd1C1PMpu+hJ/eCXi1WQxD6QY+40muk6 +KhqE3PZ8BCY2b+VpywUF5gVH28mo3jscqAzhf2dZ3SQlzldI+hFyKPxTdAqkfUOH + +--- cinb+wzjVfTkpfm1CtFIFaepwoQVCj1MquB5rAC45Ew + +6 +ZCHS0 7 EX* qb=OwuP ǖѳ/mv2Vī +xv[̂A~evd0ni1қQ"@ٹ{Kp:ϵusB(Xr[QVgT@*B .hE鲟뒭zlz|k`l88McchZ` ?yeo+M-:/**cZD2&Ǣ e*Hn"~+|ua(6J \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 368b837..7b5fdd8 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -17,4 +17,5 @@ in "phantom-renawiki.age".publicKeys = [ main_ssh_public_key ]; "phantom-forgejo-mailer-password.age".publicKeys = [ main_ssh_public_key ]; "phantom-mastodon-mailer-password.age".publicKeys = [ main_ssh_public_key ]; + "phantom-invidious-settings.age".publicKeys = [ main_ssh_public_key ]; }