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:
William A. Kennington III 2014-06-27 01:45:04 -05:00
parent 4da69cb7da
commit aa77fe0fb0
2 changed files with 21 additions and 12 deletions

View File

@ -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!

View File

@ -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";
};
};
};