I'm licensing my project under MPL 2.0, but I have a certain directory for utilities that I don't want to be under copyleft.
If I put an MIT license in the said directory, can it override the MPL 2.0 on the root of the repository?
Open Source Stack Exchange is a question and answer site for people organizing, marketing or licensing open source development projects. It only takes a minute to sign up.Sign up to join this community
Effectively yes, although I suggest you are much more explicit about exactly which material you intend to place under each license than just throwing some license files in some directories.
In particular, there is no real concept of an "MPL 2.0 repository" - copyright (and thus open source licensing) exists at a more granular level than that of a repository. This often means at a file level, although it could in theory be even more granular than that. The MPL strongly encourages you to add a specific notice (that in Exhibit A) to each file you intend to be covered by the MPL. The MIT license is less prescriptive than this, but if you are intending to have a repository with mixed licensing it will make things much clearer for any consumers of the repository if you include a specific statement in each file making its licensing clear rather than relying on their location in the tree.
I suggest you add the MIT license in that directory and in addition add proper SPDX identifiers in each of the files in order to create an unambiguous situation.