diff --git a/pkgs/image/default.nix b/pkgs/image/default.nix index 7d5f565..e82b49a 100644 --- a/pkgs/image/default.nix +++ b/pkgs/image/default.nix @@ -15,9 +15,7 @@ runCommand pname { erofs-utils dosfstools mtools - e2fsprogs jq - openssl ]; env = { @@ -159,7 +157,7 @@ ${patosPkgs.systemd}/usr/bin/systemd-repart \ --size=auto \ --definitions=./final.repart.d \ --root=$out \ - patos-$version.raw > final-repart-output.json + patos-${version}.raw > final-repart-output.json rm -rf rootfs diff --git a/pkgs/rootfs/mkrootfs.nix b/pkgs/rootfs/mkrootfs.nix index fb25c4d..a40e17b 100644 --- a/pkgs/rootfs/mkrootfs.nix +++ b/pkgs/rootfs/mkrootfs.nix @@ -11,6 +11,8 @@ in runCommand "patos-rootfs" { + inherit version; + buildInputs = [ pkgs.glibc pkgs.binutils @@ -175,6 +177,9 @@ cp -P ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt $out/etc/ssl/cert.pem ln -sf ../cert.pem $out/etc/ssl/certs/ca-certificates.crt ln -sf ../cert.pem $out/etc/ssl/certs/ca-bundle.crt +# no need for pkgconfig, removing.. +rm -rf $out/usr/lib/pkgconfig + # setup default files ${patosPkgs.systemd}/usr/bin/systemd-hwdb --root=$out --usr update ${patosPkgs.systemd}/usr/bin/systemd-tmpfiles --root=$out $out/usr/lib/tmpfiles.d/etc.conf --create @@ -188,13 +193,9 @@ CREDENTIALS_DIRECTORY=$PWD/creds SYSTEMD_CRYPT_PREFIX='$6$' ${patosPkgs.systemd} chmod 600 $out/etc/shadow rm -rf creds - # Ephemeral machine-id until registration ln -sf /run/machine-id $out/etc/machine-id -# remove pkgconfig -rm -rf $out/usr/lib/pkgconfig - ### Find and install all shared libs find $out -type f -executable -exec ldd {} \; | awk '{print $3}' | \ grep -vE "(systemd|glibc|openssl|tpm2|devmapper)" | \ @@ -202,7 +203,7 @@ find $out -type f -executable -exec ldd {} \; | awk '{print $3}' | \ find $out -type f -executable -exec chmod 755 {} \; -# FIXME: ELF patching. Is there a better way? +# patch ELFs find $out -type f -executable -exec patchelf --set-rpath /lib:/usr/lib:/usr/lib/systemd:/usr/lib/cryptsetup {} \; find $out -type f -executable -exec patchelf --set-interpreter /lib/ld-linux-x86-64.so.2 {} \; patchelf --remove-rpath $out/usr/lib/ld-linux-x86-64.so.2 @@ -211,7 +212,7 @@ patchelf --remove-rpath $out/usr/lib/ld-linux-x86-64.so.2 find $out -type f -executable -exec strip {} \; find $out -type d -exec chmod 755 {} \; -### install kernel modules +# install kernel modules cp -r ${patosPkgs.kernel}/lib/modules $out/usr/lib/ find $out/usr/lib/modules -type d -exec chmod 755 {} \; ''