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" ];