mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	
							
								
								
									
										47
									
								
								minisforum/v3/audio.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								minisforum/v3/audio.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  # Fix microphone.
 | 
			
		||||
  # Based on https://github.com/mudkipme/awesome-minisforum-v3/issues/10#issuecomment-2317474057 (Volume control workaround doesn't work on Arch) 
 | 
			
		||||
  boot.extraModprobeConfig = ''
 | 
			
		||||
    options snd-hda-intel model=alc256-asus-aio
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
  # Based on https://github.com/mudkipme/awesome-minisforum-v3/issues/9#issue-2407782714 (volume control fixes for arch)
 | 
			
		||||
  services.pipewire.wireplumber.extraConfig."alsa-soft-mixer"."monitor.alsa.rules" = [
 | 
			
		||||
    {
 | 
			
		||||
      # Enable soft-mixer.
 | 
			
		||||
      # Fix global volume control.
 | 
			
		||||
      actions.update-props."api.alsa.soft-mixer" = true;
 | 
			
		||||
      matches = [
 | 
			
		||||
        {
 | 
			
		||||
          "device.name" = "~alsa_card.*";
 | 
			
		||||
        }
 | 
			
		||||
      ];
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
      # Disable soft-mixer for input devices.
 | 
			
		||||
      actions.update-props."api.alsa.soft-mixer" = false;
 | 
			
		||||
      matches = [
 | 
			
		||||
        {
 | 
			
		||||
          "device.name" = "~alsa_card.*";
 | 
			
		||||
          "node.name" = "~alsa_input.*";
 | 
			
		||||
        }
 | 
			
		||||
      ];
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
      # Disable audio session suspension.
 | 
			
		||||
      # Fix bug with plugged in headphones.
 | 
			
		||||
      # Based on https://github.com/mudkipme/awesome-minisforum-v3?tab=readme-ov-file#disable-audio-session-suspension (Disable audio session suspension)
 | 
			
		||||
      actions.update-props."session.suspend-timeout-seconds" = "0";
 | 
			
		||||
      matches = [
 | 
			
		||||
        {
 | 
			
		||||
          "node.name" = "~alsa_input.*";
 | 
			
		||||
        }
 | 
			
		||||
        {
 | 
			
		||||
          "node.name" = "~alsa_output.*";
 | 
			
		||||
        }
 | 
			
		||||
      ];
 | 
			
		||||
    }
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								minisforum/v3/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								minisforum/v3/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./sensors.nix
 | 
			
		||||
    ./audio.nix
 | 
			
		||||
    ./power.nix
 | 
			
		||||
 | 
			
		||||
    ../../common/gpu/amd/default.nix
 | 
			
		||||
    ../../common/cpu/amd/default.nix
 | 
			
		||||
    ../../common/pc/laptop/default.nix
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								minisforum/v3/dsdt.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								minisforum/v3/dsdt.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
--- dsdt.dsl	2024-08-10 06:24:09.143777067 +0200
 | 
			
		||||
+++ patched/dsdt.dsl	2024-08-10 04:58:50.191036154 +0200
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
  *     Compiler ID      "INTL"
 | 
			
		||||
  *     Compiler Version 0x20220331 (539099953)
 | 
			
		||||
  */
 | 
			
		||||
-DefinitionBlock ("", "DSDT", 2, "ALASKA", "A M I ", 0x01072009)
 | 
			
		||||
+DefinitionBlock ("", "DSDT", 2, "ALASKA", "A M I ", 0x01072019)
 | 
			
		||||
 {
 | 
			
		||||
     External (_SB_.APTS, MethodObj)    // 1 Arguments
 | 
			
		||||
     External (_SB_.AWAK, MethodObj)    // 1 Arguments
 | 
			
		||||
@@ -7341,7 +7341,7 @@
 | 
			
		||||
 
 | 
			
		||||
         Device (CIND)
 | 
			
		||||
         {
 | 
			
		||||
-            Name (_HID, "ID9001")  // _HID: Hardware ID
 | 
			
		||||
+            Name (_HID, "INT33D3")  // _HID: Hardware ID
 | 
			
		||||
             Name (_CID, "PNP0C60" /* Display Sensor Device */)  // _CID: Compatible ID
 | 
			
		||||
             Method (_STA, 0, Serialized)  // _STA: Status
 | 
			
		||||
             {
 | 
			
		||||
@@ -7364,8 +7364,8 @@
 | 
			
		||||
     {
 | 
			
		||||
         Device (STS)
 | 
			
		||||
         {
 | 
			
		||||
-            Name (_HID, EisaId ("SMOCF05"))  // _HID: Hardware ID
 | 
			
		||||
-            Name (_CID, EisaId ("SMOCF05"))  // _CID: Compatible ID
 | 
			
		||||
+            Name (_HID, EisaId ("SMO8B30"))  // _HID: Hardware ID
 | 
			
		||||
+            Name (_CID, EisaId ("SMO8B30"))  // _CID: Compatible ID
 | 
			
		||||
             Name (_UID, Zero)  // _UID: Unique ID
 | 
			
		||||
             Method (_STA, 0, NotSerialized)  // _STA: Status
 | 
			
		||||
             {
 | 
			
		||||
							
								
								
									
										19
									
								
								minisforum/v3/power.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								minisforum/v3/power.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  # From "Optimizing power draw (under Linux)": https://github.com/mudkipme/awesome-minisforum-v3/issues/5#issue-2391536450
 | 
			
		||||
  boot.kernelParams = [ "pcie_aspm.policy=powersupersave" ];
 | 
			
		||||
  systemd.services.enable-aspm = {
 | 
			
		||||
    wantedBy = [ "default.target" ];
 | 
			
		||||
    serviceConfig = {
 | 
			
		||||
      ExecStart = "${pkgs.bash}/bin/bash ${pkgs.callPackage ./src.nix { }}/aspm_v3.sh";
 | 
			
		||||
      Restart = "no";
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    path = with pkgs; [
 | 
			
		||||
      bc
 | 
			
		||||
      pciutils
 | 
			
		||||
    ];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										44
									
								
								minisforum/v3/sensors.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								minisforum/v3/sensors.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
{ pkgs, lib, ... }:
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  # Enable IIO for brightness and accelerometer sensors
 | 
			
		||||
  hardware.sensor.iio.enable = lib.mkDefault true;
 | 
			
		||||
 | 
			
		||||
  services.fprintd.enable = lib.mkDefault true;
 | 
			
		||||
  
 | 
			
		||||
  # Override ACPI DSDT to fix the accelerometer.
 | 
			
		||||
  # A driver already exists for a similar sensor.
 | 
			
		||||
  # This overrides the IDs to make the existing driver work.
 | 
			
		||||
  # From Accelerometer on Linux https://github.com/mudkipme/awesome-minisforum-v3/issues/2#issuecomment-2279282784
 | 
			
		||||
  boot.initrd.prepend =
 | 
			
		||||
    let
 | 
			
		||||
      minisforum-acpi-override = pkgs.stdenv.mkDerivation {
 | 
			
		||||
        name = "minisforum-acpi-override";
 | 
			
		||||
        CPIO_PATH = "kernel/firmware/acpi";
 | 
			
		||||
 | 
			
		||||
        src = pkgs.callPackage ./src.nix {};
 | 
			
		||||
        patches = [ ./dsdt.patch ];
 | 
			
		||||
 | 
			
		||||
        nativeBuildInputs = with pkgs; [
 | 
			
		||||
          acpica-tools
 | 
			
		||||
          cpio
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        installPhase = ''
 | 
			
		||||
          mkdir -p $CPIO_PATH
 | 
			
		||||
          iasl -tc ./dsdt.dsl
 | 
			
		||||
          cp ./dsdt.aml $CPIO_PATH
 | 
			
		||||
          find kernel | cpio -H newc --create > acpi_override
 | 
			
		||||
          cp acpi_override $out    
 | 
			
		||||
        '';
 | 
			
		||||
      };
 | 
			
		||||
    in
 | 
			
		||||
    [ (toString minisforum-acpi-override) ];
 | 
			
		||||
 | 
			
		||||
  # Fix inverted accelerometer rotation.
 | 
			
		||||
  services.udev.extraHwdb = ''
 | 
			
		||||
    sensor:modalias:acpi:SMO8B30*:dmi:*svnMicroComputer*:pnV3:*
 | 
			
		||||
      ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								minisforum/v3/src.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								minisforum/v3/src.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
# Outsource (MIT License) for aspm_v3.sh and dsdt.dsl
 | 
			
		||||
{ fetchFromGitHub, ... }:
 | 
			
		||||
fetchFromGitHub {
 | 
			
		||||
  owner = "eum3l";
 | 
			
		||||
  repo = "minisforum-v3-nixos-hardware";
 | 
			
		||||
  rev = "7a94dbac701640cef91ec5b1873868a512718f09";
 | 
			
		||||
  hash = "sha256-V23Vuw/DV0l2c0m2hBnjZ2uey0KMeAdymnlLqXbFFUM=";
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user