summary refs log tree commit diff
path: root/img/app/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-05-27 22:33:31 +0000
committerAlyssa Ross <hi@alyssa.is>2023-05-31 10:27:32 +0000
commit75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc (patch)
treeed4888ea0aa2470ea99e5d9df2db85322a309285 /img/app/default.nix
parent997d39121cdb61bf2ba0852839e65f8adf633209 (diff)
downloadspectrum-75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc.tar
spectrum-75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc.tar.gz
spectrum-75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc.tar.bz2
spectrum-75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc.tar.lz
spectrum-75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc.tar.xz
spectrum-75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc.tar.zst
spectrum-75a1ac3d62bf8c641e7145f46ebd6e9d01e6d3dc.zip
vm: switch to EROFS
Diffstat (limited to 'img/app/default.nix')
-rw-r--r--img/app/default.nix22
1 files changed, 12 insertions, 10 deletions
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;