mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  config,
 | 
						|
  lib,
 | 
						|
  pkgs,
 | 
						|
  ...
 | 
						|
}:
 | 
						|
{
 | 
						|
  config =
 | 
						|
    lib.mkIf config.hardware.librem5.audio {
 | 
						|
      services.dbus.packages = [ pkgs.callaudiod ];
 | 
						|
    }
 | 
						|
    // (
 | 
						|
      let
 | 
						|
        paConfig = {
 | 
						|
          enable = true;
 | 
						|
          # this is required to correctly configure the modem as PA source/sink
 | 
						|
          extraConfig = ''
 | 
						|
            .include ${config.hardware.librem5.package}/etc/pulse/librem5.pa
 | 
						|
          '';
 | 
						|
        };
 | 
						|
      in
 | 
						|
      if lib.versionOlder (lib.versions.majorMinor lib.version) "25.05" then
 | 
						|
        {
 | 
						|
          assertions = [
 | 
						|
            {
 | 
						|
              assertion = config.hardware.pulseaudio.enable;
 | 
						|
              message = "Call audio on Librem5 requires pulse audio to be enabled through `hardware.pulseaudio.enable`.";
 | 
						|
            }
 | 
						|
          ];
 | 
						|
          hardware.pulseaudio = paConfig;
 | 
						|
        }
 | 
						|
      else
 | 
						|
        {
 | 
						|
          assertions = [
 | 
						|
            {
 | 
						|
              assertion = config.services.pulseaudio.enable;
 | 
						|
              message = "Call audio on Librem5 requires pulse audio to be enabled through `services.pulseaudio.enable`.";
 | 
						|
            }
 | 
						|
          ];
 | 
						|
          services.pulseaudio = paConfig;
 | 
						|
        }
 | 
						|
    );
 | 
						|
}
 |