diff --git a/flake.nix b/flake.nix index 0a64679..8e91ce6 100644 --- a/flake.nix +++ b/flake.nix @@ -42,7 +42,7 @@ cp -r ${self.packages.${system}.systemd.out}/* out/ pushd out - find . -type d -exec chmod 755 {} \; + chmod 755 etc usr/lib usr/bin mkdir -p dev proc sys tmp root ln -sf usr/bin bin @@ -51,12 +51,15 @@ ln -sf usr/lib lib64 ln -sf ../proc/self/mounts etc/mtab - ln -sf ../usr/lib/systemd/systemd init + ln -sf usr/lib/systemd/systemd init + + ln -sf systemd/libsystemd-core-257.so usr/lib/ + ln -sf systemd/libsystemd-shared-257.so usr/lib/ echo patos > ./etc/hostname cat <<EOF > ./etc/os-release - NAME="PatOS" - PRETTY_NAME="PatOS Platform" + NAME="Patos" + PRETTY_NAME="Patos Platform" ID=patos EOF @@ -113,22 +116,20 @@ chmod 644 ./etc/group # install busybox - cp ${pkgs.busybox.out}/bin/busybox usr/bin/ - usr/bin/busybox --list | xargs -I {} ln -sf busybox usr/bin/{} + cp ${pkgs.busybox.out}/bin/busybox ./usr/bin/ + ./usr/bin/busybox --list | while read f; do + ln -sf busybox ./usr/bin/$f + done # get shared libs find . -type f -executable | xargs ldd 2> /dev/null | awk '{print $3}' | grep -v systemd | sort -u | xargs cp -t usr/lib find . -type f -executable | xargs chmod 755 - # FIXME: hacky(?) ELF patching. Is there a better way???????? - find . -type f -executable -print | xargs -I {} ${pkgs.lib.getExe pkgs.patchelf} --set-rpath /lib:/usr/lib:/usr/lib/systemd {} 2> /dev/null + # FIXME: hacky patch elf patching. Is there a better way???????? + find . -type f -executable -print | xargs -I {} ${pkgs.lib.getExe pkgs.patchelf} --set-rpath /lib {} 2> /dev/null find . -type f -executable -print | xargs -I {} ${pkgs.lib.getExe pkgs.patchelf} --set-interpreter /lib/ld-linux-x86-64.so.2 {} 2> /dev/null - cp ${ - self.packages.${system}.glibc.out - }/lib/ld-linux-x86-64.so.2 lib/ && ${pkgs.lib.getExe pkgs.patchelf} --remove-rpath lib/ld-linux-x86-64.so.2 - - # strip binaries - find . -type f -executable | xargs strip 2> /dev/null + cp ${self.packages.${system}.glibc.out}/lib/ld-linux-x86-64.so.2 lib/ + ${pkgs.lib.getExe pkgs.patchelf} --remove-rpath lib/ld-linux-x86-64.so.2 # gen initrd find . -print0 | ${pkgs.lib.getExe pkgs.cpio} --null --owner=root:root -o --format=newc | ${pkgs.lib.getExe pkgs.gzip} -9 > ../initrd.gz diff --git a/systemd/default.nix b/systemd/default.nix index ce35023..7537aeb 100644 --- a/systemd/default.nix +++ b/systemd/default.nix @@ -188,14 +188,13 @@ stdenv.mkDerivation (finalAttrs: { (lib.mesonOption "tty-gid" "3") # tty in NixOS has gid 3 (lib.mesonOption "kmod-path" "/bin/kmod") - (lib.mesonOption "debug-shell" "/bin/sh") + (lib.mesonOption "debug-shell" "/bin/bash") (lib.mesonOption "pamconfdir" "/etc/pam.d") (lib.mesonOption "shellprofiledir" "/etc/profile.d") (lib.mesonOption "dbuspolicydir" "/usr/share/dbus-1/system.d") (lib.mesonOption "dbussessionservicedir" "/usr/share/dbus-1/services") (lib.mesonOption "dbussystemservicedir" "/usr/share/dbus-1/system-services") (lib.mesonOption "setfont-path" "/bin/setfont") - (lib.mesonOption "loadkeys-path" "/bin/loadkeys") (lib.mesonOption "sulogin-path" "/bin/sulogin") (lib.mesonOption "nologin-path" "/bin/nologin") (lib.mesonOption "mount-path" "/bin/mount")