From 81b226dfece07eb57847190f9ca45a30e4c007c1 Mon Sep 17 00:00:00 2001 From: Thomas Syms Date: Thu, 9 Jan 2025 10:39:36 -0400 Subject: [PATCH] Updated duo configuration --- hosts/Bellerophon/duo-configuration.nix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/hosts/Bellerophon/duo-configuration.nix b/hosts/Bellerophon/duo-configuration.nix index 9a20d3c..2810f5a 100644 --- a/hosts/Bellerophon/duo-configuration.nix +++ b/hosts/Bellerophon/duo-configuration.nix @@ -9,19 +9,25 @@ # Path to the duo script duoScript = "${duoRepo}/duo"; - # Modify the shebang and create a new script - modifiedDuoScript = pkgs.writeShellScript "modified-duo" '' - #!${pkgs.bash}/bin/bash - cd "$(dirname "$(realpath "$0")")" - ${builtins.readFile duoScript} - ''; + # Read and modify the script content + modifiedScriptContent = + builtins.replaceStrings [ + "#!/usr/bin/env bash" + "prefered_resolution=\"2880x1800@120.000\"" + ] [ + "#!${pkgs.bash}/bin/bash" + "prefered_resolution=\"2880x1800@120.000+vrr\"" + ] (builtins.readFile duoScript); + + # Write the modifications to a patched duo file + patchedDuoScript = pkgs.writeShellScript "patched-duo" modifiedScriptContent; in { systemd.services.watchBacklight = { description = "synchronize screen brightness"; wantedBy = ["default.target"]; path = [pkgs.inotify-tools pkgs.sudo]; serviceConfig = { - ExecStart = "${modifiedDuoScript} watch-backlight"; + ExecStart = "${patchedDuoScript} watch-backlight"; Restart = "always"; RestartSec = 5; }; @@ -34,7 +40,7 @@ in { path = [pkgs.gnome-monitor-config pkgs.usbutils pkgs.inotify-tools]; serviceConfig = { - ExecStart = "${modifiedDuoScript} watch-displays"; + ExecStart = "${patchedDuoScript} watch-displays"; Restart = "always"; RestartSec = 5; }; @@ -46,7 +52,7 @@ in { after = ["graphical-session.target"]; path = [pkgs.gnome-monitor-config pkgs.iio-sensor-proxy]; serviceConfig = { - ExecStart = "${modifiedDuoScript} watch-rotation"; + ExecStart = "${patchedDuoScript} watch-rotation"; Restart = "always"; RestartSec = 5; };