nixos/radvd: Convert to a systemd unit
Additionally, remove the automatic initialization of the ipv6 forwarding sysctl as this should be handled by the end user. This really should not be an issue as most people running radvd are likely forwarding ipv6 packets.
This commit is contained in:
parent
4da69cb7da
commit
aa77fe0fb0
|
@ -146,6 +146,7 @@
|
|||
neo4j = 136;
|
||||
riemann = 137;
|
||||
riemanndash = 138;
|
||||
radvd = 139;
|
||||
|
||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||
|
||||
|
|
|
@ -52,24 +52,32 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = [ pkgs.radvd ];
|
||||
users.extraUsers.radvd =
|
||||
{ uid = config.ids.uids.radvd;
|
||||
description = "Router Advertisement Daemon User";
|
||||
};
|
||||
|
||||
jobs.radvd =
|
||||
systemd.services.radvd =
|
||||
{ description = "IPv6 Router Advertisement Daemon";
|
||||
|
||||
startOn = "started network-interfaces";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
preStart =
|
||||
''
|
||||
# !!! Radvd only works if IPv6 forwarding is enabled. But
|
||||
# this should probably be done somewhere else (and not
|
||||
# necessarily for all interfaces).
|
||||
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
||||
'';
|
||||
after = [ "network.target" ];
|
||||
|
||||
exec = "${pkgs.radvd}/sbin/radvd -m syslog -s -C ${confFile}";
|
||||
path = [ pkgs.radvd ];
|
||||
|
||||
daemonType = "fork";
|
||||
preStart = ''
|
||||
mkdir -m 755 -p /run/radvd
|
||||
chown radvd /run/radvd
|
||||
'';
|
||||
|
||||
serviceConfig =
|
||||
{ ExecStart = "@${pkgs.radvd}/sbin/radvd radvd"
|
||||
+ " -p /run/radvd/radvd.pid -m syslog -u radvd -C ${confFile}";
|
||||
Restart = "always";
|
||||
Type = "forking";
|
||||
PIDFile = "/run/radvd/radvd.pid";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue