nixos/diod: use upstream systemd unit
This commit is contained in:
@@ -9,20 +9,6 @@ let
|
||||
|
||||
diodBool = b: if b then "1" else "0";
|
||||
|
||||
diodConfig = pkgs.writeText "diod.conf" ''
|
||||
allsquash = ${diodBool cfg.allsquash}
|
||||
auth_required = ${diodBool cfg.authRequired}
|
||||
exportall = ${diodBool cfg.exportall}
|
||||
exportopts = "${lib.concatStringsSep "," cfg.exportopts}"
|
||||
exports = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'') cfg.exports)} }
|
||||
listen = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'') cfg.listen)} }
|
||||
logdest = "${cfg.logdest}"
|
||||
nwthreads = ${toString cfg.nwthreads}
|
||||
squashuser = "${cfg.squashuser}"
|
||||
statfs_passthru = ${diodBool cfg.statfsPassthru}
|
||||
userdb = ${diodBool cfg.userdb}
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
in
|
||||
{
|
||||
options = {
|
||||
@@ -150,13 +136,22 @@ in
|
||||
config = lib.mkIf config.services.diod.enable {
|
||||
environment.systemPackages = [ pkgs.diod ];
|
||||
|
||||
systemd.services.diod = {
|
||||
description = "diod 9P file server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.diod}/sbin/diod -f -c ${diodConfig}";
|
||||
};
|
||||
};
|
||||
environment.etc."diod.conf".text = ''
|
||||
allsquash = ${diodBool cfg.allsquash}
|
||||
auth_required = ${diodBool cfg.authRequired}
|
||||
exportall = ${diodBool cfg.exportall}
|
||||
exportopts = "${lib.concatStringsSep "," cfg.exportopts}"
|
||||
exports = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'') cfg.exports)} }
|
||||
listen = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'') cfg.listen)} }
|
||||
logdest = "${cfg.logdest}"
|
||||
nwthreads = ${toString cfg.nwthreads}
|
||||
squashuser = "${cfg.squashuser}"
|
||||
statfs_passthru = ${diodBool cfg.statfsPassthru}
|
||||
userdb = ${diodBool cfg.userdb}
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
systemd.packages = [ pkgs.diod ];
|
||||
systemd.services.diod.wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user