|  | 
|  | 1 | +{ | 
|  | 2 | +  config, | 
|  | 3 | +  lib, | 
|  | 4 | +  pkgs, | 
|  | 5 | +  ... | 
|  | 6 | +}: | 
|  | 7 | + | 
|  | 8 | +let | 
|  | 9 | +  cfg = config.hardware.gpd.duo; | 
|  | 10 | +in | 
|  | 11 | +with lib; | 
|  | 12 | +{ | 
|  | 13 | +  imports = [ | 
|  | 14 | +    ./duo-specific | 
|  | 15 | +    ../../common/pc/laptop | 
|  | 16 | +    ../../common/pc/ssd | 
|  | 17 | +    ../../common/hidpi.nix | 
|  | 18 | +  ]; | 
|  | 19 | + | 
|  | 20 | +  options = { | 
|  | 21 | +    hardware.gpd.duo.preventWakeOnAC = mkOption { | 
|  | 22 | +      type = types.bool; | 
|  | 23 | +      default = false; | 
|  | 24 | +      description = '' | 
|  | 25 | +        Stop the system waking from suspend when the AC is plugged | 
|  | 26 | +        in. The catch: it also disables waking from the keyboard. | 
|  | 27 | +
 | 
|  | 28 | +        See: | 
|  | 29 | +        https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 | 
|  | 30 | +      ''; | 
|  | 31 | +    }; | 
|  | 32 | +  }; | 
|  | 33 | + | 
|  | 34 | +  config = { | 
|  | 35 | +    # Workaround applied upstream in Linux >=6.7 (on BIOS 03.03) | 
|  | 36 | +    # https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193 | 
|  | 37 | +    services.udev.extraRules = | 
|  | 38 | +      mkIf (versionOlder config.boot.kernelPackages.kernel.version "6.7" && cfg.preventWakeOnAC) | 
|  | 39 | +        '' | 
|  | 40 | +          # Prevent wake when plugging in AC during suspend. Trade-off: keyboard wake disabled. See: | 
|  | 41 | +          # https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 | 
|  | 42 | +          ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled" | 
|  | 43 | +        ''; | 
|  | 44 | + | 
|  | 45 | +    # Replace 'left' with 'right' or 'inverted' as needed | 
|  | 46 | +    # Fixes DUO stupid inverted display at boot | 
|  | 47 | +    # Enable kernel module for your graphics (adjust if needed) | 
|  | 48 | +    boot.kernelModules = [ "amdgpu" ]; | 
|  | 49 | + | 
|  | 50 | +    # Set the eDP-1 panel video parameters for display rotation | 
|  | 51 | +    boot.kernelParams = mkBefore [ | 
|  | 52 | +      "video=eDP-1:2880x1800,panel_orientation=upside_down" | 
|  | 53 | +      "video=DP-3:2880x1800" | 
|  | 54 | +      "i2c_touchscreen_props=GXTP7380:touchscreen-inverted-x:touchscreen-inverted-y" | 
|  | 55 | +    ]; | 
|  | 56 | + | 
|  | 57 | +    hardware.gpd.duo.audioEnhancement.rawDeviceName = | 
|  | 58 | +      mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; | 
|  | 59 | +  }; | 
|  | 60 | +} | 
0 commit comments