{ lib, config, ... }: let inherit (lib) types mkIf mkDefault; in { options.systemd.services = lib.mkOption { type = let osConfig = config; in types.attrsOf ( lib.types.submodule ( { config, name, ... }: { config.serviceConfig = mkIf (osConfig.specialisation != { }) { ProtectHostname = mkDefault true; }; } ) ); }; config = mkIf (config.specialisation != { }) { systemd.services = { systemd-hostnamed.serviceConfig.ProtectHostname = false; nix-daemon.serviceConfig.ProtectHostname = false; }; }; }