title: How to change the serviceConfig of a service defined in nixpkgs from configuration.nix?
body: <p>The nagios in nixpkgs has <code>systemd.services.nagios.serviceConfig.Restart="always";</code> which is cluttering the <code>journalctl -u nagios</code> log and should be Restart="no"; instead!</p>
  
  <h1>MySQL fix</h1>
  
  <p>For MySQL this works:</p>
  
  <pre><code>systemd.services.mysql.serviceConfig = {
    Restart = "always";
    RestartSec="10s";
    StartLimitInterval="1min";
  };
  </code></pre>
  
  <p>Since the MySQL service does not list any of the 'Restart', 'RestartSec', or 'StartLimitInterval' I suppose.</p>
  
  <h1>Attempted nagios fix</h1>
  
  <p>Using the same mechanism for nagios as for MySQL before, I try:</p>
  
  <pre><code>systemd.services.nagios.serviceConfig.Restart = "no";
  </code></pre>
  
  <p>Gives me a:</p>
  
  <pre><code>error: The option `systemd.services.nagios.serviceConfigRestart' defined in `/etc/nixos/configuration.nix' does not exist.
  (use ‘--show-trace’ to show detailed location information)
  </code></pre>
  
  <p>If I updated it to:</p>
  
  <pre><code>systemd.services.nagios.serviceConfig = lib.mkForce { Restart = "no"; };
  </code></pre>
  
  <p>The result is that the values in <code>systemd.services.mysql.serviceConfig</code> are now only containing 'Restart' but lack the important 'ExecStart' and other service definitions:</p>
  
  <pre><code>journalctl -u nagios
  nagios.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
  </code></pre>
  
  <p>Finally using this:</p>
  
  <pre><code>systemd.services.nagios.serviceConfig = config.systemd.services.nagios.serviceConfig // { Restart = "no"; };
  </code></pre>
  
  <p>Give me a:</p>
  
  <pre><code>nixos-rebuild switch
  error: infinite recursion encountered, at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix:199:44
  (use ‘--show-trace’ to show detailed location information)
  </code></pre>