about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJared Baur <jaredbaur@fastmail.com>2024-04-21 01:55:03 -0700
committerJörg Thalheim <joerg@thalheim.io>2024-06-27 09:02:40 +0200
commit87eaf12aaff7df31f401010476a02c6d7a1be4ad (patch)
tree739a8feabc23771bae2df321c1eb4a47eee00a4a
parent0f89f47505711bd50df4400ab3f16421888cbd3b (diff)
nixos/etc: fix using etc overlay on cross-compiled systems backport-321991-to-release-24.05
We need to run tooling from the build platform when generating the EROFS.

(cherry picked from commit 560cd874a37396968aea0bd9abc54fb1122424b7)
-rw-r--r--nixos/modules/system/etc/etc.nix14
1 files changed, 4 insertions, 10 deletions
diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix
index 0411faee6ebb8..87932075f3679 100644
--- a/nixos/modules/system/etc/etc.nix
+++ b/nixos/modules/system/etc/etc.nix
@@ -64,14 +64,6 @@ let
 
   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
 
 {
@@ -295,10 +287,12 @@ in
     system.build.etcMetadataImage =
       let
         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
       pkgs.runCommand "etc-metadata.erofs" {
-        nativeBuildInputs = [ pkgs.composefs pkgs.erofs-utils ];
+        nativeBuildInputs = with pkgs.buildPackages; [ composefs erofs-utils ];
       } ''
         mkcomposefs --from-file ${etcDump} $out
         fsck.erofs $out