···9595 '';
9696 };
97979898+ chroot = mkOption {
9999+ default = true;
100100+ type = types.bool;
101101+ description = ''
102102+ Change process root directory to the directory where the config file is located (/etc/tinc/netname/), for added security.
103103+ The chroot is performed after all the initialization is done, after writing pid files and opening network sockets.
104104+105105+ Note that tinc can't run scripts anymore (such as tinc-down or host-up), unless it is setup to be runnable inside chroot environment.
106106+ '';
107107+ };
98108 };
99109 };
100110 };
···166176 fi
167177 '';
168178 script = ''
169169- tincd -R -D -U tinc.${network} -n ${network} --pidfile /run/tinc.${network}.pid -d ${toString data.debugLevel}
179179+ tincd -D -U tinc.${network} -n ${network} ${optionalString (data.chroot) "-R"} --pidfile /run/tinc.${network}.pid -d ${toString data.debugLevel}
170180 '';
171181 })
172182 );