The federal government has struck a last-minute deal with the Liberals to pass contentious new laws targeting hate groups.