{pkgs, lib, config, ...}: let cfg = config.dysnomia; printProperties = properties: lib.concatMapStrings (propertyName: let property = properties.${propertyName}; in if lib.isList property then "${propertyName}=(${lib.concatMapStrings (elem: "\"${toString elem}\" ") (properties.${propertyName})})\n" else "${propertyName}=\"${toString property}\"\n" ) (builtins.attrNames properties); properties = pkgs.stdenv.mkDerivation { name = "dysnomia-properties"; buildCommand = '' cat > $out << "EOF" ${printProperties cfg.properties} EOF ''; }; containersDir = pkgs.stdenv.mkDerivation { name = "dysnomia-containers"; buildCommand = '' mkdir -p $out cd $out ${lib.concatMapStrings (containerName: let containerProperties = cfg.containers.${containerName}; in '' cat > ${containerName} < /etc/systemd-mutable/system/dysnomia.target fi ''; }; }