{ lib, runCommand, writeShellScriptBin, }: { name, prefix ? "10-all-", dirs ? [ "service" "mount" "socket" "timer" "target" ], dropinText ? null, extraCommands ? "", ... }@args: runCommand "${name}-dropin" ( lib.removeAttrs args [ "name" ] // { inherit dirs dropinText extraCommands; } ) '' set -euo pipefail root=$out/lib/systemd/system for dir in $dirs ; do mkdir -p "$root/$dir".d printf "%s" "$dropinText" > "$root/$dir.d/${prefix}${name}.conf" done runHook extraCommands ''