anchor.diff:  let
   
     inherit (pkgs) alsaUtils;
  -
  -  soundState = "/var/lib/alsa/asound.state";
  -
  -  configPath = "asound.conf";
   
   in
   
  
positive.code: 
        extraConfig = mkOption {
          type = types.lines;
          default = '''';
          example = ''
            defaults.pcm.!card 3
          '';
  
negative.code: 
      environment.systemPackages = [ alsaUtils ];
  
      environment.etc = mkIf (config.sound.extraConfig != "")
        [
          { source = pkgs.writeText "asound.conf" config.sound.extraConfig;
            target = "asound.conf";
          }
        ];
  
      # ALSA provides a udev rule for restoring volume settings.
      services.udev.packages = [ alsaUtils ];
  