Major changes
This commit is contained in:
61
hosts/nixos/Bellerophon/duo-configuration.nix
Normal file
61
hosts/nixos/Bellerophon/duo-configuration.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{pkgs, ...}: let
|
||||
# Clone the repository
|
||||
duoRepo = builtins.fetchGit {
|
||||
url = "https://github.com/alesya-h/zenbook-duo-2024-ux8406ma-linux";
|
||||
# Specify a specific commit or branch if needed
|
||||
rev = "2b8be1840f38f92e6626da7a442245b74ed0715f"; # Uncomment this line to specify a branch or commit
|
||||
};
|
||||
|
||||
# Path to the duo script
|
||||
duoScript = "${duoRepo}/duo";
|
||||
|
||||
# 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 = "${patchedDuoScript} watch-backlight";
|
||||
Restart = "always";
|
||||
RestartSec = 5;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.watchDisplays = {
|
||||
description = "set screens on keyboard event";
|
||||
wantedBy = ["default.target"];
|
||||
after = ["graphical-session.target"];
|
||||
|
||||
path = [pkgs.gnome-monitor-config pkgs.usbutils pkgs.inotify-tools];
|
||||
serviceConfig = {
|
||||
preStart = "${patchedDuoScript} normal";
|
||||
ExecStart = "${patchedDuoScript} watch-displays";
|
||||
Restart = "always";
|
||||
RestartSec = 5;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.watchRotation = {
|
||||
description = "rotate screens";
|
||||
wantedBy = ["default.target"];
|
||||
after = ["graphical-session.target"];
|
||||
path = [pkgs.gnome-monitor-config pkgs.iio-sensor-proxy];
|
||||
serviceConfig = {
|
||||
ExecStart = "${patchedDuoScript} watch-rotation";
|
||||
Restart = "always";
|
||||
RestartSec = 5;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user