Packages without options in configuration.nix

I’ll preface this by saying I’m a nix noob…

I’m trying to get package net-snmp going. There doesn’t seem to be any way to control it from configuration.nix. I can specify it as a package so it’s installed, but I can’t include any config files embedded in the configuration.nix, nor start it automatically. Is that common? The /var/log/net-snmp.log file refers to a snmpconf perl program do build a config but that wasn’t included in the package.

I’m sure I can get it going the old fashioned way, I’m just trying to do it the nix way. (also because it makes it harder to deploy a server)

1 Like

I found this article that looks like it would be a solution to my issue…for creating arbitrary files in /etc:

Now I just need to figure out how to start the daemon at boot-up and how to pass arguments to it like:
snmpd -c /etc/snmp/snmpd.conf

1 Like

This should do well: systemd.services..script

Not having any luck. This is what I have so far, please tell me if I’m on the right track:

systemd.services = {
snmpd = {
description = “Net-SNMP daemon”;
wantedBy = [ “multi-user.target” ];
after = [ “network.target” ];
restartIfChanged = true;

   serviceConfig = {
     User = "root";
     Group = "root";
     Restart = "always";
     ExecStart = "${pkgs.net-snmp}/bin/snmpd -c /etc/snmp/snmpd.conf";
   };
 };

};

systemd.services.snmpd.enable = true;

also tried this:

systemd.services.snmpd.script = “/bin/snmpd -c /etc/snmp/snmpd.conf”;
systemd.services.snmpd.enable = true;