nixos/etc: fix using etc overlay on cross-compiled systems

We need to run tooling from the build platform when generating the EROFS.
This commit is contained in:
Jared Baur 2024-04-21 01:55:03 -07:00
parent 3664857c48
commit 560cd874a3
No known key found for this signature in database

View File

@ -64,14 +64,6 @@ let
etcHardlinks = filter (f: f.mode != "symlink" && f.mode != "direct-symlink") etc'; etcHardlinks = filter (f: f.mode != "symlink" && f.mode != "direct-symlink") etc';
build-composefs-dump = pkgs.buildPackages.runCommand "build-composefs-dump.py"
{
buildInputs = [ pkgs.buildPackages.python3 ];
} ''
install ${./build-composefs-dump.py} $out
patchShebangs --host $out
'';
in in
{ {
@ -295,10 +287,12 @@ in
system.build.etcMetadataImage = system.build.etcMetadataImage =
let let
etcJson = pkgs.writeText "etc-json" (builtins.toJSON etc'); etcJson = pkgs.writeText "etc-json" (builtins.toJSON etc');
etcDump = pkgs.runCommand "etc-dump" { } "${build-composefs-dump} ${etcJson} > $out"; etcDump = pkgs.runCommand "etc-dump" { } ''
${lib.getExe pkgs.buildPackages.python3} ${./build-composefs-dump.py} ${etcJson} > $out
'';
in in
pkgs.runCommand "etc-metadata.erofs" { pkgs.runCommand "etc-metadata.erofs" {
nativeBuildInputs = [ pkgs.composefs pkgs.erofs-utils ]; nativeBuildInputs = with pkgs.buildPackages; [ composefs erofs-utils ];
} '' } ''
mkcomposefs --from-file ${etcDump} $out mkcomposefs --from-file ${etcDump} $out
fsck.erofs $out fsck.erofs $out