From 8b7658bfa57bcc361bdb7d79c80f9cf0bde62db0 Mon Sep 17 00:00:00 2001 From: beviu Date: Wed, 15 Apr 2026 15:45:27 +0200 Subject: [PATCH 1/2] installer/nixos-generate-config: use lib.getExe --- nixos/modules/installer/tools/tools.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 086d8971d466..f3f60dfbdd49 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -30,15 +30,15 @@ let name = "nixos-generate-config"; src = ./nixos-generate-config.pl; replacements = { - perl = "${ + perl = lib.getExe ( pkgs.perl.withPackages (p: [ p.FileSlurp p.ConfigIniFiles ]) - }/bin/perl"; + ); hostPlatformSystem = pkgs.stdenv.hostPlatform.system; - detectvirt = "${config.systemd.package}/bin/systemd-detect-virt"; - btrfs = "${pkgs.btrfs-progs}/bin/btrfs"; + detectvirt = lib.getExe' config.systemd.package "systemd-detect-virt"; + btrfs = lib.getExe pkgs.btrfs-progs; inherit (config.system.nixos-generate-config) configuration desktopConfiguration flake; xserverEnabled = config.services.xserver.enable; }; From 623ec633ba806be11031a0cd1760649edd9d5c3a Mon Sep 17 00:00:00 2001 From: beviu Date: Wed, 15 Apr 2026 16:07:29 +0200 Subject: [PATCH 2/2] nixos-generate-config: substitute bcachefs For systems where the package is marked as broken, use `false` instead. The Perl script checks for a non-zero exit status, so it will handle it as if the command failed. --- nixos/modules/installer/tools/nixos-generate-config.pl | 2 +- nixos/modules/installer/tools/tools.nix | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 3d0f4a9f7d86..96d0d68e5c93 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -505,7 +505,7 @@ EOF # This should work for single and multi-device systems. # still needs subvolume support if ($fsType eq "bcachefs") { - my ($status, @info) = runCommand("bcachefs fs usage $rootDir$mountPoint"); + my ($status, @info) = runCommand("@bcachefs@ fs usage $rootDir$mountPoint"); my $UUID = $info[0]; if ($status == 0 && $UUID =~ /^Filesystem:[ \t\n]*([0-9a-z-]+)/) { diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index f3f60dfbdd49..6ce3e2839371 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -38,6 +38,11 @@ let ); hostPlatformSystem = pkgs.stdenv.hostPlatform.system; detectvirt = lib.getExe' config.systemd.package "systemd-detect-virt"; + bcachefs = + if pkgs.bcachefs-tools.meta.broken then + lib.getExe' pkgs.coreutils "false" + else + lib.getExe pkgs.bcachefs-tools; btrfs = lib.getExe pkgs.btrfs-progs; inherit (config.system.nixos-generate-config) configuration desktopConfiguration flake; xserverEnabled = config.services.xserver.enable;