Code snippet: Command line tool lftp for a parallel recursive secure FTP download of a remote directory.

Parallel Recursive FTPS Mirroring (Directory Download) from Command Line

TL;DR In this blog post, I show you the best option I found that you can use in 2024 to perform a parallel recursive download (backup) of an FTP directory via FTPS (explicit FTP via TLS) from the command line. lftp is the best command line tool (for Linux, macOS and other UNIX-like systems), but needs to be properly configured. For GUI-focused users, I recommend FileZilla. Introduction FTP is a quite outdated protocol Read more…

Compile Linux out-of-tree Module on NixOS in a Nix shell with an FHS Environment

In an earlier post, I talked about how you can build an out-of-tree Linux kernel module in a Nix derivation, i.e., package it in Nix. However, for quick prototyping, sometimes you want to just enter $ make in your shell, for example to check if everything compiles. Out-of-tree module projects following the recommended guidelines use a Makefile, possibly an additional KBuild file, and of course C source and header files. This header file Read more…

systemd udev Rules to Detect USB Device Plugging (including Bus and Device Number)

The other day, I was working on some udev rules to invoke a script when a USB device is added or removed from my machine. I needed the USB bus and USB port number to further process that event. I decided to use udev for that. However, getting the relevant attributes was not as intuitive as I expected, and existing documentation wasn’t that good. Here’s what I did and how I solved it. Read more…

Fixing “Illegal path references in fixed-output derivation” in Nix

The other day I was working with fixed-output derivations. After copying several files to $out, I was facing a “Illegal path references in fixed-output derivation error”. The only helpful reference on the internet I could find was the Nix source code on GitHub. It took me a while to figure out what’s going on. You get this error when your fixed-output derivation places something in $out which contains a Nix store path! This Read more…

Screenshot: Nix build: "illegal path referenced in fixed-output derivation". The part on the top shows all Nix store paths that accidentally landed in the derivation (obtained by "grep")
Code Snippet: Fixed output derivation in Nix

Accessing Network from a Nix Derivation (via Fixed output derivations)

Usually, Nix derivations are build in a sandbox that prevent any program from accessing the network. This has a good reason: We want reproducibility in Nix, and using the network is not reproducible for many reasons! But there must be a way of accessing the network from a derivation, right? Why? Because, builtins.fetchGit or builtins.fetchTarball are not flexible enough to cope with the nature of Maven, Cargo, npm or other tools that download Read more…

How to use `gcc_multi` with a specific GCC version in nixpkgs?

I recently came across the problem that pkgs.gcc_multi comes with gcc in version 12 but I needed version 11. While nixpkgs exports gcc in multiple versions (pkgs.gcc, pkgs.gcc11, pkgs.gcc12, pkgs.gcc13), pkgs.gcc_multi is only exported once, backed with the version coming from pkgs.gcc. However, using another, specific gcc version is fairly simple. In <nixpkgs at NixOS 23.11>/pkgs/top-level/all-packages.nix we can find gcc_multi. This is aliased to pkgs.wrapCCMulti gcc (function call), which is defined in the Read more…