From ade259a29d4f7b849da6ee5beb0b849964bcfc70 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Mon, 24 Nov 2025 11:54:26 +0100 Subject: [PATCH] systemd: disable utmp on musl Fixes https://github.com/NixOS/nixpkgs/pull/461277#issuecomment-3556593423 Musl does not have utmp. Systemd implicitly disables utmp support, but we need to document this disable in nix or else `nixos/modules/system/boot/systemd.nix` will attempt to load a non-existant service resulting in errors. --- pkgs/os-specific/linux/systemd/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 8c5aa4097a4b..a0d654c1a4cd 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -156,7 +156,11 @@ # adds python to closure which is too much by default withUkify ? false, withUserDb ? true, - withUtmp ? true, + # utmp does not exist on musl, so it would be implicitly disabled + # It is important to document the lack of utmp in nix, + # otherwise the condition for systemd-update-utmp.service will + # attempt to load a service which does not exist, resulting in errors. + withUtmp ? !stdenv.hostPlatform.isMusl, withVmspawn ? true, # kernel-install shouldn't usually be used on NixOS, but can be useful, e.g. for # building disk images for non-NixOS systems. To save users from trying to use it