From ef2bde5a13a0964b80d8cf0def8e7d478869dad5 Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Mon, 17 Mar 2025 15:03:53 +0100 Subject: [PATCH] docker: use serviceConfig.ExecStart instead of script --- nixos/modules/virtualisation/docker.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix index 00a99b6fcd7d..511c377ca984 100644 --- a/nixos/modules/virtualisation/docker.nix +++ b/nixos/modules/virtualisation/docker.nix @@ -1,6 +1,6 @@ # Systemd services for docker. -{ config, lib, pkgs, ... }: +{ config, lib, utils, pkgs, ... }: with lib; @@ -271,11 +271,15 @@ in restartIfChanged = false; unitConfig.X-StopOnRemoval = false; - serviceConfig.Type = "oneshot"; - - script = '' - ${cfg.package}/bin/docker system prune -f ${toString cfg.autoPrune.flags} - ''; + serviceConfig = { + Type = "oneshot"; + ExecStart = utils.escapeSystemdExecArgs ([ + (lib.getExe cfg.package) + "system" + "prune" + "-f" + ] ++ cfg.autoPrune.flags); + }; startAt = optional cfg.autoPrune.enable cfg.autoPrune.dates; after = [ "docker.service" ];