iso-image: Use unionfs-fuse instead of aufs
This commit is contained in:
parent
90e825481d
commit
be4f69519b
@ -192,34 +192,41 @@ in
|
|||||||
options = "loop";
|
options = "loop";
|
||||||
};
|
};
|
||||||
|
|
||||||
# We need squashfs in the initrd to mount the compressed Nix store,
|
boot.initrd.availableKernelModules = [ "squashfs" "iso9660" ];
|
||||||
# and aufs to make the root filesystem appear writable.
|
|
||||||
boot.extraModulePackages =
|
|
||||||
if config.boot.kernelPackages.aufs == null then
|
|
||||||
abort "This kernel doesn't have aufs enabled"
|
|
||||||
else
|
|
||||||
[ config.boot.kernelPackages.aufs ];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "aufs" "squashfs" "iso9660" ];
|
boot.initrd.kernelModules = [ "loop" "fuse" ];
|
||||||
|
|
||||||
boot.initrd.kernelModules = [ "loop" ];
|
|
||||||
|
|
||||||
boot.kernelModules = pkgs.stdenv.lib.optional config.isoImage.makeEfiBootable "efivars";
|
boot.kernelModules = pkgs.stdenv.lib.optional config.isoImage.makeEfiBootable "efivars";
|
||||||
|
|
||||||
|
# Need unionfs-fuse
|
||||||
|
boot.initrd.extraUtilsCommands = ''
|
||||||
|
cp -v ${pkgs.fuse}/lib/libfuse* $out/lib
|
||||||
|
cp -v ${pkgs.unionfs-fuse}/bin/unionfs $out/bin
|
||||||
|
'';
|
||||||
|
|
||||||
# In stage 1, mount a tmpfs on top of / (the ISO image) and
|
# In stage 1, mount a tmpfs on top of / (the ISO image) and
|
||||||
# /nix/store (the squashfs image) to make this a live CD.
|
# /nix/store (the squashfs image) to make this a live CD.
|
||||||
boot.initrd.postMountCommands =
|
boot.initrd.postMountCommands =
|
||||||
''
|
''
|
||||||
mkdir /mnt-root-tmpfs
|
# Hacky!!! fuse hard-codes the path to mount
|
||||||
mount -t tmpfs -o "mode=755" none /mnt-root-tmpfs
|
mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.utillinux.name}/bin
|
||||||
|
ln -s $(which mount) /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.utillinux.name}/bin
|
||||||
|
ln -s $(which umount) /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.utillinux.name}/bin
|
||||||
|
|
||||||
|
mkdir -p /unionfs-chroot$targetRoot
|
||||||
|
mount --rbind $targetRoot /unionfs-chroot$targetRoot
|
||||||
|
|
||||||
|
mkdir /unionfs-chroot/mnt-root-tmpfs
|
||||||
|
mount -t tmpfs -o "mode=755" none /unionfs-chroot/mnt-root-tmpfs
|
||||||
mkdir /mnt-root-union
|
mkdir /mnt-root-union
|
||||||
mount -t aufs -o dirs=/mnt-root-tmpfs=rw:$targetRoot=ro none /mnt-root-union
|
unionfs -o allow_other,cow,chroot=/unionfs-chroot /mnt-root-tmpfs=RW:$targetRoot=RO /mnt-root-union
|
||||||
|
oldTargetRoot=$targetRoot
|
||||||
targetRoot=/mnt-root-union
|
targetRoot=/mnt-root-union
|
||||||
|
|
||||||
mkdir /mnt-store-tmpfs
|
mkdir /unionfs-chroot/mnt-store-tmpfs
|
||||||
mount -t tmpfs -o "mode=755" none /mnt-store-tmpfs
|
mount -t tmpfs -o "mode=755" none /unionfs-chroot/mnt-store-tmpfs
|
||||||
mkdir -p $targetRoot/nix/store
|
mkdir -p $oldTargetRoot/nix/store
|
||||||
mount -t aufs -o dirs=/mnt-store-tmpfs=rw:/mnt-root/nix/store=ro none /mnt-root-union/nix/store
|
unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot /mnt-store-tmpfs=RW:$oldTargetRoot/nix/store=RO /mnt-root-union/nix/store
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Closures to be copied to the Nix store on the CD, namely the init
|
# Closures to be copied to the Nix store on the CD, namely the init
|
||||||
|
@ -332,8 +332,8 @@ exec 3>&-
|
|||||||
udevadm control --exit || true
|
udevadm control --exit || true
|
||||||
|
|
||||||
# Kill any remaining processes, just to be sure we're not taking any
|
# Kill any remaining processes, just to be sure we're not taking any
|
||||||
# with us into stage 2.
|
# with us into stage 2. unionfs-fuse mounts require the unionfs process.
|
||||||
pkill -9 -v 1
|
pkill -9 -v '(1|unionfs)'
|
||||||
|
|
||||||
|
|
||||||
if test -n "$debug1mounts"; then fail; fi
|
if test -n "$debug1mounts"; then fail; fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user