you can have a look at the permutation test test in MNE. It is for a t-test
but you can write the t-test as a GLM

https://github.com/mne-tools/mne-python/blob/master/mne/stats/tests/test_permutations.py