Re: [PATCH v2 1/8] host/rootfs: Install all programs from util-linuxMinimal

Alyssa Ross
2025-11-13T12:35:27Z

[-- Attachment #1: Type: text/plain, Size: 3617 bytes --]

Demi Marie Obenour <demiobenour@gmail.com> writes:

> Busybox fdisk doesn't support GPT, only MBR. Busybox programs are also
> often buggy, so use the util-linux version where possible. This
> requires disabling a lot of Busybox applets, so move the Busybox config
> to a separate file that Nix loads via builtins.readFile.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
> host/rootfs/busybox-config | 134 +++++++++++++++++++++++++++++++++++++
> host/rootfs/busybox-config.license | 4 ++
> host/rootfs/default.nix | 36 +++-------
> 3 files changed, 147 insertions(+), 27 deletions(-)

> diff --git a/host/rootfs/busybox-config.license b/host/rootfs/busybox-config.license
> new file mode 100644
> index 0000000000000000000000000000000000000000..ba50b647fbfac9b79ecb29f33a36c07d3e332ba2
> --- /dev/null
> +++ b/host/rootfs/busybox-config.license
> @@ -0,0 +1,4 @@
> +# SPDX-License-Identifier: MIT
> +# SPDX-FileCopyrightText: 2021-2025 Alyssa Ross <hi@alyssa.is>
> +# SPDX-FileCopyrightText: 2022 Unikie
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
> index eb6c64067091ef3802596ce581f82f322f5bfe34..aea2e46bb5998176eb6d9b8aef802ae270fdd28c 100644
> --- a/host/rootfs/default.nix
> +++ b/host/rootfs/default.nix
> @@ -38,25 +38,8 @@ let
> virtiofsd xdg-desktop-portal-spectrum-host
>
> (busybox.override {
> - extraConfig = ''
> - CONFIG_CHATTR n
> - CONFIG_DEPMOD n
> - CONFIG_FINDFS n
> - CONFIG_HALT n
> - CONFIG_INIT n
> - CONFIG_INSMOD n
> - CONFIG_IP n
> - CONFIG_LSATTR n
> - CONFIG_LSMOD n
> - CONFIG_MKE2FS n
> - CONFIG_MKFS_EXT2 n
> - CONFIG_MODINFO n
> - CONFIG_MODPROBE n
> - CONFIG_MOUNT n
> - CONFIG_POWEROFF n
> - CONFIG_REBOOT n
> - CONFIG_RMMOD n
> - '';
> + # Use a separate file as it is a bit too big.
> + extraConfig = builtins.readFile ./busybox-config;
> })
>
> # Take kmod from pkgsGui since we use pkgsGui.kmod.lib below anyway.
> @@ -96,6 +79,12 @@ let
> mkdir -p $out/usr/bin $out/usr/share/dbus-1/services \
> $out/usr/share/icons/hicolor/20x20/apps
>
> + # lndir silently ignores existing links, so run it before ln
> + # so that ln catches any duplicates.
> + for pkg in ${escapeShellArgs usrPackages}; do
> + lndir -ignorelinks -silent "$pkg" "$out/usr"
> + done
> +
> # Weston doesn't support SVG icons.
> inkscape -w 20 -h 20 \
> -o $out/usr/share/icons/hicolor/20x20/apps/com.system76.CosmicFiles.png \
> @@ -110,18 +99,11 @@ let
> ln -st $out/usr/share/dbus-1/services \
> ${pkgsGui.xdg-desktop-portal-gtk}/share/dbus-1/services/org.freedesktop.impl.portal.desktop.gtk.service
>
> - for pkg in ${escapeShellArgs usrPackages}; do
> - lndir -ignorelinks -silent "$pkg" "$out/usr"
> - done
> + ln -st "$out/usr/bin" ${util-linuxMinimal}/bin/*

Why not just add it to packages?

>
> ${concatStrings (mapAttrsToList (name: path: ''
> ln -s ${path} $out/usr/lib/spectrum/vm/${name}
> '') appvms)}
> -
> - # TODO: this is a hack and we should just build the util-linux
> - # programs we want.
> - # https://lore.kernel.org/util-linux/87zgrl6ufb.fsf@alyssa.is/
> - ln -s ${util-linuxMinimal}/bin/{findfs,uuidgen,lsblk,mount} $out/usr/bin
> '';
> in
>
>
> --
> 2.51.2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]