How do I set up qmk for flashing keyboards?

Hello, I’m a Nix newbie on nixos, and I’m following the qmk tutorial guide and I did:

nix-env -iA nixos.qmk
qmk setup

The qmk-setup command complained that qmk was missing some python dependencies.

Could not find module dotty-dict!
Could not find module hid!
Could not find module hjson!
Could not find module jsonschema!
Could not find module pygments!
Could not find module pyusb!

Would you like to install the required Python modules? [y/n] y

/nix/store/66fbv9mmx1j4hrn9y06kcp73c3yb196r-python3-3.8.9/bin/python3.8: No module named pip
Your MILC library is too old! Please upgrade: python3 -m pip install -U -r /home/thanawat/code/qmk_firmware/requirements.txt

I’m not really sure how to fix this with the current nix knowledge that I have(Should I modify the nix expression for the package and add the python dependencies somehow? Not sure). Some help would be great! Thank you so much!

I found that using just the nix-shell --pure --run "make ..." works, but it takes more than an hour to compile on my machine… (it’s still compiling…)


I’m sure this can be handled, but even after moving to NixOS, out of the power of habit I kept on using the method I used to use on Debian, and that is through their Docker support.

I would prefer to use Nix over Docker any day, but I am not flashing frequently enough to change this dirty habit :slight_smile:


I tried to get QMK working on nixos but was not Successfull with all the dependencis. In the end i also just used the docker support.

I see you’ve mostly figured it out!

The reason it takes so long is because the nix-shell is likely compiling all the tools you need to then be able to compile your firmware.

You may want to try making a gcroot for your shell via nix-direnv or some other means to cache those dependencies.


Cool! I usually use lorri for that. It would be nice for the qmk cli to work, but from looking at it(only a little bit) it seems like a wrapper for make(and other command) so it’s not super necessary to use.

edit: i’m kind of preemptively trying to use qmk, without a keyboard to flash it on… I just ordered my iris, and am super excited to build my first keyboard!!

For sure! I’m in a similar boat actually, just trying to design the layout for my GMMK pro as well :grin:

1 Like

I get “No module named ‘qmk_cli’” once I’ve dropped into the nix-shell and done qmk init. I just assumed naively that all nixos users would have appreciated the benefit of truly programmable keyboards and this would be a well trodden path…

" (which simply can’t use the install script – in this environment, the shell.nix is intended to replace that)"
so maybe qmk init isn’t something we’re meant to run. make crkbd:default worked for me once I had done git submodule update

Hmm I think I need to add custom udev rules to make my device writable…(so I can flash it)
Hmm sudo from the dir with my custom keyboard layout works a treat. Yay!