nixos/diod: use upstream systemd unit

This commit is contained in:
rnhmjoj
2025-12-12 16:46:36 +01:00
parent 46114dbb06
commit bc3fc17951
@@ -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" ];
};
}