From 6479f584f7247f43eba2f37304bcb085f8ae8995 Mon Sep 17 00:00:00 2001 From: Pasquale Date: Fri, 19 Nov 2021 00:01:56 +0100 Subject: [PATCH 1/4] Added ROG Strix G733QS --- README.md | 1 + asus/battery.nix | 21 +++++++++++++++++ asus/rog-strix/g733qs/default.nix | 29 ++++++++++++++++++++++++ asus/rog-strix/g733qs/hda-jack-retask.fw | 16 +++++++++++++ flake.nix | 2 ++ 5 files changed, 69 insertions(+) create mode 100644 asus/battery.nix create mode 100644 asus/rog-strix/g733qs/default.nix create mode 100644 asus/rog-strix/g733qs/hda-jack-retask.fw diff --git a/README.md b/README.md index 45c9b7c..f90a220 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ See code for all available configurations. | [Apple MacBook Pro 12,1](apple/macbook-pro/12-1) | `` | | [Apple MacBook Pro 10,1](apple/macbook-pro/10-1) | `` | | [Asus TUF FX504GD](asus/fx504gd) | `` | +| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `` | | [Asus ROG Zephyrus G14 GA401](asus/zephyrus/ga401) | `` | | [BeagleBoard PocketBeagle](beagleboard/pocketbeagle) | `` | | [Dell G3 3779](dell/g3/3779) | `` | diff --git a/asus/battery.nix b/asus/battery.nix new file mode 100644 index 0000000..c2a275b --- /dev/null +++ b/asus/battery.nix @@ -0,0 +1,21 @@ +{ config, pkgs, lib, ... }: +let + p = pkgs.writeScriptBin "charge-upto" '' + echo ''${0:-100} > /sys/class/power_supply/BAT0/charge_control_end_threshold + ''; + cfg = config.hardware.asus; +in + +{ + options.hardware.asus.chargeUpto = lib.mkOption { + description = "Maximum level of charge for your battery, as a percentage."; + default = 100; + type = lib.types.int; + }; + config = { + environment.systemPackages = [ p ]; + systemd.tmpfiles.rules = [ + "w /sys/class/power_supply/BAT0/charge_control_end_threshold - - - - ${toString cfg.chargeUpto}" + ]; + }; +} diff --git a/asus/rog-strix/g733qs/default.nix b/asus/rog-strix/g733qs/default.nix new file mode 100644 index 0000000..2884104 --- /dev/null +++ b/asus/rog-strix/g733qs/default.nix @@ -0,0 +1,29 @@ +{ config, pkgs, lib, ... }: +{ + imports = [ + ../../../common/cpu/amd + ../../../common/gpu/nvidia.nix + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../battery.nix + ]; + + # fixing audio by overriding pins as suggested in + # https://www.reddit.com/r/ASUS/comments/mfokva/asus_strix_scar_17_g733qs_and_linux/ + hardware.firmware = [ + (pkgs.runCommand "jack-retask" { } '' + install -D ${./hda-jack-retask.fw} $out/lib/firmware/hda-jack-retask.fw + '') + ]; + boot.extraModprobeConfig = '' + options snd-hda-intel patch=hda-jack-retask.fw + ''; + # before 5.12 it would interpret every keystroke as the power button + boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + + hardware.nvidia.prime = { + offload.enable = lib.mkDefault true; + amdgpuBusId = "PCI:5:0:0"; + nvidiaBusId = "PCI:1:0:1"; + }; +} diff --git a/asus/rog-strix/g733qs/hda-jack-retask.fw b/asus/rog-strix/g733qs/hda-jack-retask.fw new file mode 100644 index 0000000..0797187 --- /dev/null +++ b/asus/rog-strix/g733qs/hda-jack-retask.fw @@ -0,0 +1,16 @@ +[codec] +0x10ec0285 0x10431e6e 0 + +[pincfg] +0x12 0x90a60140 +0x13 0x40000000 +0x14 0x90170152 +0x16 0x411111f0 +0x17 0x90170110 +0x18 0x411111f0 +0x19 0x03a19020 +0x1a 0x411111f0 +0x1b 0x411111f0 +0x1d 0x40663a45 +0x1e 0x90170151 +0x21 0x03211020 diff --git a/flake.nix b/flake.nix index 49d2f9d..84a1d6d 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,9 @@ outputs = { self }: { nixosModules = { dell-aspire-4810t = import ./acer/aspire/4810t; + asus-battery = import ./asus/battery.nix; asus-fx504gd = import ./asus/fx504gd; + asus-rog-strix-g733qs = import ./asus/rog-strix/g733qs; asus-zephyrus-ga401 = import ./asus/zephyrus/ga401; apple-macbook-air-3 = import ./apple/macbook-air/3; apple-macbook-air-4 = import apple/macbook-air/4; From a9de532758241c1aec78f62ea677ff635c0cb288 Mon Sep 17 00:00:00 2001 From: pasqui23 Date: Sat, 20 Nov 2021 22:23:42 +0000 Subject: [PATCH 2/4] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f90a220..52a7df8 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ See code for all available configurations. | [Apple MacBook Pro 12,1](apple/macbook-pro/12-1) | `` | | [Apple MacBook Pro 10,1](apple/macbook-pro/10-1) | `` | | [Asus TUF FX504GD](asus/fx504gd) | `` | -| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `` | +| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `` | | [Asus ROG Zephyrus G14 GA401](asus/zephyrus/ga401) | `` | | [BeagleBoard PocketBeagle](beagleboard/pocketbeagle) | `` | | [Dell G3 3779](dell/g3/3779) | `` | From 4161f8aee8c750fb7b0c3605f257877d9e9c42ae Mon Sep 17 00:00:00 2001 From: pasqui23 Date: Sat, 20 Nov 2021 22:26:52 +0000 Subject: [PATCH 3/4] Update asus/battery.nix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- asus/battery.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asus/battery.nix b/asus/battery.nix index c2a275b..e9bb254 100644 --- a/asus/battery.nix +++ b/asus/battery.nix @@ -7,7 +7,7 @@ let in { - options.hardware.asus.chargeUpto = lib.mkOption { + options.hardware.asus.battery.chargeUpto = lib.mkOption { description = "Maximum level of charge for your battery, as a percentage."; default = 100; type = lib.types.int; @@ -15,7 +15,7 @@ in config = { environment.systemPackages = [ p ]; systemd.tmpfiles.rules = [ - "w /sys/class/power_supply/BAT0/charge_control_end_threshold - - - - ${toString cfg.chargeUpto}" + "w /sys/class/power_supply/BAT0/charge_control_end_threshold - - - - ${toString cfg.battery.chargeUpto}" ]; }; } From 2051241010c87ffda348c97c092a1358753f8ecd Mon Sep 17 00:00:00 2001 From: pasqui23 Date: Wed, 24 Nov 2021 20:49:28 +0000 Subject: [PATCH 4/4] g733qs: lates linux only if kernel older than 5.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- asus/rog-strix/g733qs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asus/rog-strix/g733qs/default.nix b/asus/rog-strix/g733qs/default.nix index 2884104..89ec2a7 100644 --- a/asus/rog-strix/g733qs/default.nix +++ b/asus/rog-strix/g733qs/default.nix @@ -19,7 +19,7 @@ options snd-hda-intel patch=hda-jack-retask.fw ''; # before 5.12 it would interpret every keystroke as the power button - boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (lib.mkDefault pkgs.linuxPackages_latest); hardware.nvidia.prime = { offload.enable = lib.mkDefault true;