From bc3fc179515a5ae27e69768c16415a7a5bbc8ba8 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Tue, 9 Dec 2025 20:56:00 +0100 Subject: [PATCH] nixos/diod: use upstream systemd unit --- .../services/network-filesystems/diod.nix | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/nixos/modules/services/network-filesystems/diod.nix b/nixos/modules/services/network-filesystems/diod.nix index 8ad0d6e53893..efc870ee29c5 100644 --- a/nixos/modules/services/network-filesystems/diod.nix +++ b/nixos/modules/services/network-filesystems/diod.nix @@ -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" ]; }; }