Properly configure `typos` in `pre-commit-hooks.nix` (now `git-hooks.nix`)

2024-04: Ongoing Upstream Discussion There is an ongoing upstream discussion for a pull request of mine that tries to mitigate this issues of the typos integration with pre-commit-hooks.nix I present in the following. I don’t know if it is ever getting merged – many opinions, limited time, stressed maintainers, complicated edge cases, different valid variants of usage of typos, stressed me – not blaming anyone!. However, IMHO, you should configure typos as follows, Read more…

Set CTest Arguments from CMake (for `make test`)

Just a quick follow-up to my previous post. It was somehow trickier than I thought to set arguments for CTest from CMake. In the end, the solution is quite simple, but existing resources weren’t as helpful as they should. For reference: If you type $ ninja test or $ make test in the generated build directory from CMake, CTest is invoked under the hood. By setting CMAKE_CTEST_ARGUMENTS at the right place in your Read more…

Set CTest arguments from CMake (Code Snippet).
Code snippet: Installing Catch2 from and using it in a CMake-project in GitHub CI

CMake-Project with Catch2 (v3) Unit Tests + Testing in GitHub CI

Hey you all, it’s been a while. Happy new year! In today’s blog post, I’d like to present you the solution for a problem I encountered. It’s not rocket science, but I didn’t find something helpful on the internet, and I love to make things easily googleable. TL;DR: Check out my example project on GitHub. I was working on a CMake-based project that builds libraries, which should be tested. These unit tests are Read more…

Nix Overlays: Add attribute to “lib” and avoid “infinite recursion error”

The other day, I was about to add an attribute to pkgs.lib using a nixpkgs overlay. There is a small and subtle pitfall when doing so, which made me create this short blog post. A basic overlay looks like this: By looking at the architecture diagram, we see that both prev and final refer to what pkgs is, just in different “generations” (or iteration steps) in the evaluation of the final nixpkgs instance. Read more…

Terminal Screenshot: Running a Linux VM with the debugcon driver in QEMU.

Writing a Linux Driver for QEMU’s Debugcon Device

Update: Since Cloud Hypervisor release v38, you can also run a Linux with this driver in Cloud Hypervisor and see the output. In earlier blog posts, I discussed QEMU’s debugcon device and presented a minimal driver for it written in x86 assembly. In this blog post, we go a little further and write a driver for Linux in C. The driver should provide a /dev/debugcon character device so that processes can open the Read more…

Building an Out-of-Tree Linux Kernel Module in Nix

Update 2024-04-10: Updated with my latest knowledge about this topic. In this blog post, I’m going to show you briefly how you can compile an out-of-tree Linux kernel module in Nix. I use regular Nix for that and no Nix flakes. However, with flakes, the approach is similar. Background Knowledge An out-of-tree Linux kernel module is a standalone piece of code outside the Linux kernel source repository. They are used when people don’t Read more…