anchor.diff:    username = config.users.users.mirakurun.name;
     groupname = config.users.users.mirakurun.group;
     settingsFmt = pkgs.formats.yaml {};
  +
  +  polkitRule = pkgs.writeTextDir "share/polkit-1/rules.d/10-mirakurun.rules" ''
  +    polkit.addRule(function (action, subject) {
  +      if (
  +        (action.id == "org.debian.pcsc-lite.access_pcsc" ||
  +          action.id == "org.debian.pcsc-lite.access_card") &&
  +        subject.user == "${username}"
  +      ) {
  +        return polkit.Result.YES;
  +      }
  +    });
  +  '';
   in
     {
       options = {
  
positive.code:     };
  
      config = mkIf cfg.enable {
        environment.systemPackages = [ mirakurun ];
        environment.etc = {
          "mirakurun/server.yml".source = settingsFmt.generate "server.yml" cfg.serverSettings;
          "mirakurun/tuners.yml" = mkIf (cfg.tunerSettings != null) {
  
negative.code:           description = ''
              Path to unix socket to listen on. If <literal>null</literal>, it
              won't listen on any unix sockets.
            '';
          };
  
          allowSmartCardAccess = mkOption {
            type = types.bool;
            default = true;
            description = ''
              Install polkit rules to allow Mirakurun to access smart card readers
              which is commonly used along with tuner devices.
            '';
          };
  
  