From 75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 27 May 2023 22:33:31 +0000 Subject: vm: switch to EROFS --- img/app/default.nix | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'img/app/default.nix') diff --git a/img/app/default.nix b/img/app/default.nix index 7bcb2dd..ab87eda 100644 --- a/img/app/default.nix +++ b/img/app/default.nix @@ -12,7 +12,7 @@ import ../../lib/eval-config.nix ( config.pkgs.pkgsStatic.callPackage ( { lib, stdenvNoCC, runCommand, writeReferencesToFile, buildPackages -, jq, s6-rc, tar2ext4, util-linux +, erofs-utils, jq, s6-rc, util-linux , busybox, cacert, execline, kmod, mdevd, s6, s6-linux-init }: @@ -45,12 +45,6 @@ let ln -s ${cacert}/etc/ssl $out/usr/share ''; - packagesTar = runCommand "packages.tar" {} '' - cd ${packagesSysroot} - tar -cf $out --verbatim-files-from \ - -T ${writeReferencesToFile packagesSysroot} . - ''; - kernelTarget = if stdenvNoCC.hostPlatform.isx86 then # vmlinux.bin is the stripped version of vmlinux. @@ -69,7 +63,7 @@ let VIRTIO_PCI = yes; VIRTIO_BLK = yes; VIRTIO_CONSOLE = yes; - EXT4_FS = yes; + EROFS_FS = yes; EXPERT = yes; FONTS = lib.mkForce unset; FONT_8x8 = lib.mkForce unset; @@ -92,11 +86,19 @@ stdenvNoCC.mkDerivation { inherit src; sourceRoot = "source/img/app"; - nativeBuildInputs = [ jq lseek s6-rc tar2ext4 util-linux ]; + nativeBuildInputs = [ erofs-utils jq lseek s6-rc util-linux ]; - PACKAGES_TAR = packagesTar; + PACKAGES = [ packagesSysroot "/" ]; KERNEL = "${kernel}/${baseNameOf kernelTarget}"; + shellHook = '' + PACKAGES+=" $(sed p ${writeReferencesToFile packagesSysroot} | tr '\n' ' ')" + ''; + + preBuild = '' + runHook shellHook + ''; + makeFlags = [ "prefix=$(out)" ]; dontInstall = true; -- cgit 1.4.1