{ stdenv , pkgs , lib }: with lib; with lib.lists; with lib.attrsets; rec { tmpFilesFromDirectories = user: group: d: let wrapTmpfiles = dir: mode: "d '${dir}' ${mode} ${user} ${group} - -"; in mapAttrsToList wrapTmpfiles d; systemd = { mkService = {name, content, timer ? null}: stdenv.mkDerivation { inherit name; src = pkgs.writeTextDir "${name}.service" content; timerSrc = pkgs.writeTextDir "${name}.timer" timer; installPhase = '' mkdir -p $out/etc/systemd/system cp $src/*.service $out/etc/systemd/system '' + (if timer == null then "" else '' cp $timerSrc/*.timer $out/etc/systemd/system ''); }; }; mkConfigFile = {dir, name, content}: stdenv.mkDerivation rec { inherit name; src = pkgs.writeTextDir name content; buildCommand = '' mkdir -p $out cp ${src}/${name} $out/${name} echo "${dir}" > $out/.dysnomia-targetdir cat > $out/.dysnomia-fileset <