diff --git a/README.md b/README.md index 45c9b7c..52a7df8 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..e9bb254 --- /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.battery.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.battery.chargeUpto}" + ]; + }; +} diff --git a/asus/rog-strix/g733qs/default.nix b/asus/rog-strix/g733qs/default.nix new file mode 100644 index 0000000..89ec2a7 --- /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.mkIf (lib.versionOlder pkgs.linux.version "5.12") (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;