Asound.conf: What's the best way to implement this?

@rnhmjoj

I did the following:

sound.extraConfig = {
#
# asoundrc entries for Traktor Audio 6
# Carl Brothers <decibelkaos at gmail.com>
#

# These options will Enable/Disable the passthrough on your Traktor
# Audio 6.  Personally, I just created shortcut buttons with the
# commands, and it works flawlessly.
#
# amixer -c T6 cset numid=1 on   # switch PASSTHRU on channel A
# amixer -c T6 cset numid=2 on   # switch PASSTHRU on channel B
# amixer -c T6 cset numid=3 on   # switch PHONO/LINE on channel A
# amixer -c T6 cset numid=4 on   # switch PHONO/LINE on channel B

pcm.T6_capture {
	type dsnoop
	ipc_key 1646
	slave {
		pcm "hw:T6"
		period_size 0
		buffer_size 65536
		rate 44100
		channels 6
	}
}

pcm.T6_playback {
	type dmix
	ipc_key 1646
	slave {
		pcm "hw:T6"
		period_size 0
		buffer_size 65536
		rate 44100
		channels 6
	}
}

pcm.T6_duplex {
	type asym
	playback.pcm T6_playback
	capture.pcm T6_capture
}

pcm.T6_pair1 {
	type plug
	ttable.0.0 1.0
	ttable.1.1 1.0
	slave.pcm T6_duplex
}

pcm.T6_pair2 {
	type plug
	ttable.0.2 1.0
	ttable.1.3 1.0
	slave.pcm T6_duplex
}

pcm.T6_pair3 {
	type plug
	ttable.0.4 1.0
	ttable.1.5 1.0
	slave.pcm T6_duplex
}
};

And it’s giving me the following output error:

error:
       … while evaluating the attribute 'config'

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:9:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          323|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: syntax error, unexpected '{', expecting '.' or '='

       at /etc/nixos/configuration.nix:181:16:

          180|
          181| pcm.T6_capture {
             |                ^
          182|     type dsnoop
building Nix...
error:
       … while evaluating the attribute 'config'

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:9:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          323|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: syntax error, unexpected '{', expecting '.' or '='

       at /etc/nixos/configuration.nix:181:16:

          180|
          181| pcm.T6_capture {
             |                ^
          182|     type dsnoop
building the system configuration...
error:
       … while evaluating the attribute 'config.system.build.toplevel'

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:9:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          323|         _module = checked (config._module);

       … while calling the 'seq' builtin

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: syntax error, unexpected '{', expecting '.' or '='

       at /etc/nixos/configuration.nix:181:16:

          180|
          181| pcm.T6_capture {
             |                ^
          182|       type dsnoop

I can’t seem to find a manual or any instructions on how to use sound.extraConfig, but I do see it here: NixOS Search