Added duo configuration to Bellerophon
This commit is contained in:
16
flake.nix
16
flake.nix
@@ -52,20 +52,6 @@
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
# GNOME 46: triple-buffering-v4-46
|
||||
(_final: prev: {
|
||||
gnome = prev.gnome.overrideScope (_gnomeFinal: gnomePrev: {
|
||||
mutter = gnomePrev.mutter.overrideAttrs (_old: {
|
||||
src = pkgs.fetchFromGitLab {
|
||||
domain = "gitlab.gnome.org";
|
||||
owner = "vanvugt";
|
||||
repo = "mutter";
|
||||
rev = "triple-buffering-v4-46";
|
||||
hash = "sha256-fkPjB/5DPBX06t7yj0Rb3UEuu5b9mu3aS+jhH18+lpI=";
|
||||
};
|
||||
});
|
||||
});
|
||||
})
|
||||
];
|
||||
};
|
||||
in {
|
||||
@@ -155,7 +141,7 @@
|
||||
./home
|
||||
./home/shell
|
||||
./home/applications
|
||||
./home/desktops/kde
|
||||
./home/desktops/gnome
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
/*
|
||||
apostrophe
|
||||
bottles
|
||||
blackbox-terminal
|
||||
@@ -37,5 +38,6 @@
|
||||
tangram
|
||||
textpieces
|
||||
video-trimmer
|
||||
*/
|
||||
];
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
...
|
||||
}: {
|
||||
dconf.settings = {
|
||||
"org/gnome/desktop/interface" = {
|
||||
color-scheme = lib.mkForce "prefer-dark";
|
||||
};
|
||||
"org/gnome/desktop/interface".color-scheme = lib.mkForce "prefer-dark";
|
||||
"org/gnome/mutter".experimental-features = ["variable-refresh-rate" "scale-monitor-framebuffer"];
|
||||
|
||||
"org/gnome/shell" = {
|
||||
disable-user-extensions = false;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
"screen-rotate@shyzus.github.io"
|
||||
"dash-to-dock@micxgx.gmail.com"
|
||||
"launch-new-instance@gnome-shell-extensions.gcampax.github.com"
|
||||
"forge@jmmaranan.com"
|
||||
"power-profile-switcher@eliapasquali.github.io"
|
||||
"pop-shell@system76.com"
|
||||
];
|
||||
};
|
||||
};
|
||||
@@ -29,7 +29,7 @@
|
||||
gnomeExtensions.screen-rotate
|
||||
gnomeExtensions.dash-to-dock
|
||||
gnomeExtensions.launch-new-instance
|
||||
gnomeExtensions.forge
|
||||
gnomeExtensions.pop-shell
|
||||
gnomeExtensions.power-profile-switcher
|
||||
#gnomeExtensions.gjs-osk -- Disabled due to issue with read only file system
|
||||
];
|
||||
|
||||
@@ -11,6 +11,10 @@ in {
|
||||
|
||||
imports = [
|
||||
# Import hardware configuration
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-intel
|
||||
|
||||
./hardware-configuration.nix
|
||||
./duo-configuration.nix
|
||||
inputs.disko.nixosModules.disko
|
||||
./disko.nix
|
||||
|
||||
@@ -19,46 +23,15 @@ in {
|
||||
../../modules/containers.nix
|
||||
../../modules/virtualization.nix
|
||||
../../modules/harden.nix
|
||||
../../modules/kde.nix
|
||||
../../modules/gnome.nix
|
||||
];
|
||||
|
||||
hardware.nvidia.open = false;
|
||||
|
||||
# Set networking
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
networking.hostName = hostname;
|
||||
networking.networkmanager.enable = true;
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
|
||||
# Bootloader configuration
|
||||
boot = {
|
||||
kernelModules = ["kvm-intel"];
|
||||
extraModulePackages = [];
|
||||
|
||||
initrd = {
|
||||
kernelModules = [];
|
||||
availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
"vmd"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"rtsx_pci_sdmmc"
|
||||
];
|
||||
};
|
||||
|
||||
loader = {
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 5;
|
||||
};
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Setup Audio
|
||||
hardware.pulseaudio.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
@@ -84,4 +57,8 @@ in {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
services.hardware.bolt.enable = true;
|
||||
|
||||
hardware.sensor.iio.enable = true;
|
||||
}
|
||||
|
||||
53
hosts/Bellerophon/duo-configuration.nix
Normal file
53
hosts/Bellerophon/duo-configuration.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
{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 = "main"; # Uncomment this line to specify a branch or commit
|
||||
};
|
||||
|
||||
# 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}
|
||||
'';
|
||||
in {
|
||||
systemd.user.services.watchBacklight = {
|
||||
description = "synchronize screen brightness";
|
||||
wantedBy = ["default.target"];
|
||||
path = [pkgs.inotify-tools];
|
||||
serviceConfig = {
|
||||
ExecStart = "${modifiedDuoScript} 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 = {
|
||||
ExecStart = "${modifiedDuoScript} 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 = "${modifiedDuoScript} watch-rotation";
|
||||
Restart = "always";
|
||||
RestartSec = 5;
|
||||
};
|
||||
};
|
||||
}
|
||||
55
hosts/Bellerophon/hardware-configuration.nix
Normal file
55
hosts/Bellerophon/hardware-configuration.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "vmd" "nvme" "usbhid"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelPackages = pkgs.linuxPackages_6_10;
|
||||
boot.kernelModules = ["kvm-intel"];
|
||||
boot.kernelPatches = [
|
||||
/*
|
||||
{
|
||||
name = "zenbook-asus-wmi";
|
||||
patch = ./zenbook-asus-wmi.patch;
|
||||
}
|
||||
*/
|
||||
];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
boot.loader = {
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 5;
|
||||
};
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
|
||||
swapDevices = [];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.docker0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
sof-firmware
|
||||
];
|
||||
}
|
||||
189
hosts/Bellerophon/zenbook-asus-wmi.patch
Normal file
189
hosts/Bellerophon/zenbook-asus-wmi.patch
Normal file
@@ -0,0 +1,189 @@
|
||||
From 2f8f8e6bb2da47c677a07f76f141c527ddd5d51c Mon Sep 17 00:00:00 2001
|
||||
From: hacker1024 <hacker1024@users.sourceforge.net>
|
||||
Date: Fri, 12 Apr 2024 13:59:24 +1000
|
||||
Subject: [PATCH] asus-wmi: Add additional DEVID_THROTTLE_THERMAL_POLICY
|
||||
|
||||
---
|
||||
drivers/platform/x86/asus-wmi.c | 102 +++++++++++++++------
|
||||
include/linux/platform_data/x86/asus-wmi.h | 1 +
|
||||
2 files changed, 76 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
|
||||
index 18be35fdb381..c7958b31dae0 100644
|
||||
--- a/drivers/platform/x86/asus-wmi.c
|
||||
+++ b/drivers/platform/x86/asus-wmi.c
|
||||
@@ -93,9 +93,13 @@ module_param(fnlock_default, bool, 0444);
|
||||
#define ASUS_FAN_BOOST_MODE_SILENT_MASK 0x02
|
||||
#define ASUS_FAN_BOOST_MODES_MASK 0x03
|
||||
|
||||
+#define ASUS_THROTTLE_THERMAL_POLICY_COUNT 3
|
||||
#define ASUS_THROTTLE_THERMAL_POLICY_DEFAULT 0
|
||||
#define ASUS_THROTTLE_THERMAL_POLICY_OVERBOOST 1
|
||||
#define ASUS_THROTTLE_THERMAL_POLICY_SILENT 2
|
||||
+#define ASUS_THROTTLE_THERMAL_POLICY_LITE_DEFAULT 0
|
||||
+#define ASUS_THROTTLE_THERMAL_POLICY_LITE_OVERBOOST 2
|
||||
+#define ASUS_THROTTLE_THERMAL_POLICY_LITE_SILENT 1
|
||||
|
||||
#define USB_INTEL_XUSB2PR 0xD0
|
||||
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31
|
||||
@@ -282,6 +286,7 @@ struct asus_wmi {
|
||||
bool kbd_rgb_state_available;
|
||||
|
||||
bool throttle_thermal_policy_available;
|
||||
+ bool throttle_thermal_policy_lite;
|
||||
u8 throttle_thermal_policy_mode;
|
||||
|
||||
bool cpu_fan_curve_available;
|
||||
@@ -3404,6 +3409,14 @@ static int throttle_thermal_policy_check_present(struct asus_wmi *asus)
|
||||
err = asus_wmi_get_devstate(asus,
|
||||
ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY,
|
||||
&result);
|
||||
+ if (err == -ENODEV) {
|
||||
+ err = asus_wmi_get_devstate(asus,
|
||||
+ ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY_LITE,
|
||||
+ &result);
|
||||
+ asus->throttle_thermal_policy_lite = true;
|
||||
+ } else {
|
||||
+ asus->throttle_thermal_policy_lite = false;
|
||||
+ }
|
||||
if (err) {
|
||||
if (err == -ENODEV)
|
||||
return 0;
|
||||
@@ -3424,7 +3437,10 @@ static int throttle_thermal_policy_write(struct asus_wmi *asus)
|
||||
|
||||
value = asus->throttle_thermal_policy_mode;
|
||||
|
||||
- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY,
|
||||
+ err = asus_wmi_set_devstate(
|
||||
+ asus->throttle_thermal_policy_lite
|
||||
+ ? ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY_LITE
|
||||
+ : ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY,
|
||||
value, &retval);
|
||||
|
||||
sysfs_notify(&asus->platform_device->dev.kobj, NULL,
|
||||
@@ -3466,7 +3482,7 @@ static int throttle_thermal_policy_switch_next(struct asus_wmi *asus)
|
||||
u8 new_mode = asus->throttle_thermal_policy_mode + 1;
|
||||
int err;
|
||||
|
||||
- if (new_mode > ASUS_THROTTLE_THERMAL_POLICY_SILENT)
|
||||
+ if (new_mode > ASUS_THROTTLE_THERMAL_POLICY_COUNT - 1)
|
||||
new_mode = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT;
|
||||
|
||||
asus->throttle_thermal_policy_mode = new_mode;
|
||||
@@ -3505,7 +3521,7 @@ static ssize_t throttle_thermal_policy_store(struct device *dev,
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
- if (new_mode > ASUS_THROTTLE_THERMAL_POLICY_SILENT)
|
||||
+ if (new_mode > ASUS_THROTTLE_THERMAL_POLICY_COUNT - 1)
|
||||
return -EINVAL;
|
||||
|
||||
asus->throttle_thermal_policy_mode = new_mode;
|
||||
@@ -3536,18 +3552,34 @@ static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof,
|
||||
|
||||
tp = asus->throttle_thermal_policy_mode;
|
||||
|
||||
- switch (tp) {
|
||||
- case ASUS_THROTTLE_THERMAL_POLICY_DEFAULT:
|
||||
- *profile = PLATFORM_PROFILE_BALANCED;
|
||||
- break;
|
||||
- case ASUS_THROTTLE_THERMAL_POLICY_OVERBOOST:
|
||||
- *profile = PLATFORM_PROFILE_PERFORMANCE;
|
||||
- break;
|
||||
- case ASUS_THROTTLE_THERMAL_POLICY_SILENT:
|
||||
- *profile = PLATFORM_PROFILE_QUIET;
|
||||
- break;
|
||||
- default:
|
||||
- return -EINVAL;
|
||||
+ if (!asus->throttle_thermal_policy_lite) {
|
||||
+ switch (tp) {
|
||||
+ case ASUS_THROTTLE_THERMAL_POLICY_DEFAULT:
|
||||
+ *profile = PLATFORM_PROFILE_BALANCED;
|
||||
+ break;
|
||||
+ case ASUS_THROTTLE_THERMAL_POLICY_OVERBOOST:
|
||||
+ *profile = PLATFORM_PROFILE_PERFORMANCE;
|
||||
+ break;
|
||||
+ case ASUS_THROTTLE_THERMAL_POLICY_SILENT:
|
||||
+ *profile = PLATFORM_PROFILE_QUIET;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ } else {
|
||||
+ switch (tp) {
|
||||
+ case ASUS_THROTTLE_THERMAL_POLICY_LITE_DEFAULT:
|
||||
+ *profile = PLATFORM_PROFILE_BALANCED;
|
||||
+ break;
|
||||
+ case ASUS_THROTTLE_THERMAL_POLICY_LITE_OVERBOOST:
|
||||
+ *profile = PLATFORM_PROFILE_PERFORMANCE;
|
||||
+ break;
|
||||
+ case ASUS_THROTTLE_THERMAL_POLICY_LITE_SILENT:
|
||||
+ *profile = PLATFORM_PROFILE_QUIET;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -3561,18 +3593,34 @@ static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof,
|
||||
|
||||
asus = container_of(pprof, struct asus_wmi, platform_profile_handler);
|
||||
|
||||
- switch (profile) {
|
||||
- case PLATFORM_PROFILE_PERFORMANCE:
|
||||
- tp = ASUS_THROTTLE_THERMAL_POLICY_OVERBOOST;
|
||||
- break;
|
||||
- case PLATFORM_PROFILE_BALANCED:
|
||||
- tp = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT;
|
||||
- break;
|
||||
- case PLATFORM_PROFILE_QUIET:
|
||||
- tp = ASUS_THROTTLE_THERMAL_POLICY_SILENT;
|
||||
- break;
|
||||
- default:
|
||||
- return -EOPNOTSUPP;
|
||||
+ if (!asus->throttle_thermal_policy_lite) {
|
||||
+ switch (profile) {
|
||||
+ case PLATFORM_PROFILE_PERFORMANCE:
|
||||
+ tp = ASUS_THROTTLE_THERMAL_POLICY_OVERBOOST;
|
||||
+ break;
|
||||
+ case PLATFORM_PROFILE_BALANCED:
|
||||
+ tp = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT;
|
||||
+ break;
|
||||
+ case PLATFORM_PROFILE_QUIET:
|
||||
+ tp = ASUS_THROTTLE_THERMAL_POLICY_SILENT;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EOPNOTSUPP;
|
||||
+ }
|
||||
+ } else {
|
||||
+ switch (profile) {
|
||||
+ case PLATFORM_PROFILE_PERFORMANCE:
|
||||
+ tp = ASUS_THROTTLE_THERMAL_POLICY_LITE_OVERBOOST;
|
||||
+ break;
|
||||
+ case PLATFORM_PROFILE_BALANCED:
|
||||
+ tp = ASUS_THROTTLE_THERMAL_POLICY_LITE_DEFAULT;
|
||||
+ break;
|
||||
+ case PLATFORM_PROFILE_QUIET:
|
||||
+ tp = ASUS_THROTTLE_THERMAL_POLICY_LITE_SILENT;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EOPNOTSUPP;
|
||||
+ }
|
||||
}
|
||||
|
||||
asus->throttle_thermal_policy_mode = tp;
|
||||
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
|
||||
index ab1c7deff118..ddf5b3766cd2 100644
|
||||
--- a/include/linux/platform_data/x86/asus-wmi.h
|
||||
+++ b/include/linux/platform_data/x86/asus-wmi.h
|
||||
@@ -64,6 +64,7 @@
|
||||
#define ASUS_WMI_DEVID_SCREENPAD_LIGHT 0x00050032
|
||||
#define ASUS_WMI_DEVID_FAN_BOOST_MODE 0x00110018
|
||||
#define ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY 0x00120075
|
||||
+#define ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY_LITE 0x00110019
|
||||
|
||||
/* Misc */
|
||||
#define ASUS_WMI_DEVID_PANEL_OD 0x00050019
|
||||
--
|
||||
2.44.0
|
||||
Reference in New Issue
Block a user