Set CTest arguments from CMake (Code Snippet).

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

Just a quick follow-up to my previous post. It was trickier than I thought to set arguments for CTest from CMake then I thought. In the end it is quite simple, but existing resources weren’t as easy as they could be. 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 Read more…

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…

Code snippet: Installing Catch2 from and using it in a CMake-project in GitHub CI

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

Update 2024-01-01: Renamed self and super to final and prev as recommended by the Nix conventions. Using this names makes using overlays much easier to understand. Original Post: Today, I was about to add an attribute to the lib attribute of nixpkgs using a nixpkgs overlay. I thought that this is as straight forward as adding regular packages directly in an overlay. This wasn’t my first time using overlays, but my first time Read more…

Writing a Linux Driver for QEMU’s Debugcon Device

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 higher and write a driver for Linux in C. The driver should provide a /dev/debugcon device so that processes can open the driver device file and write data to it. Hence, $ echo “hello from Linux” > /dev/debugcon will write to the debugcon device. Only Read more…

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

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

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 want to, are not allowed to or can’t upstream drivers. Read more…

Nix: Testing a Single NixOS Module in CI

In this blog post, I explain how to test a single NixOS module in CI. By single NixOS module, I mean a module that provides some options and configurations, but itself is not a valid NixOS configuration. The use case is to have a common module (in a git repository) that you want to integrate in a full NixOS configuration, when you don’t have or want the full NixOS configuration at the same Read more…