Compiler flags only work per project. If you have more than one project in one directory - use name of file as a name of config to set different flags for each of them.
Here `first.nim` and `second.nim` \- are two separate projects: first.nim first.nims # config for `first` second.nim second.nims # config for `second` config.nims # config for both `first` and `second` Run If you try to compile `second.nim`, you should see hints telling you which config files are active: $ nim c second.nim Hint: used config file '/.../config.nims' [Conf] Hint: used config file '/.../second.nims' [Conf] ... Run Or, maybe, you're trying to set different compiler flags for two files that will compile to a single executable? As far as I know - it's not possible.