mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-01 16:34:15 +03:00
use overlayfs by default for netboot and iso
This commit is contained in:
parent
eacc771f72
commit
0c20feb231
@ -569,14 +569,18 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/nix/store" =
|
fileSystems."/nix/store" =
|
||||||
{ fsType = "unionfs-fuse";
|
{ fsType = "overlay";
|
||||||
device = "unionfs";
|
device = "overlay";
|
||||||
options = [ "allow_other" "cow" "nonempty" "chroot=/mnt-root" "max_files=32768" "hide_meta_files" "dirs=/nix/.rw-store=rw:/nix/.ro-store=ro" ];
|
options = [
|
||||||
|
"lowerdir=/nix/.ro-store"
|
||||||
|
"upperdir=/nix/.rw-store/store"
|
||||||
|
"workdir=/nix/.rw-store/work"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "uas" ];
|
boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "uas" "overlay" ];
|
||||||
|
|
||||||
boot.initrd.kernelModules = [ "loop" ];
|
boot.initrd.kernelModules = [ "loop" "overlay" ];
|
||||||
|
|
||||||
# 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
|
||||||
# script and the top-level system configuration directory.
|
# script and the top-level system configuration directory.
|
||||||
|
@ -50,14 +50,18 @@ with lib;
|
|||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/nix/store" =
|
fileSystems."/nix/store" =
|
||||||
{ fsType = "unionfs-fuse";
|
{ fsType = "overlay";
|
||||||
device = "unionfs";
|
device = "overlay";
|
||||||
options = [ "allow_other" "cow" "nonempty" "chroot=/mnt-root" "max_files=32768" "hide_meta_files" "dirs=/nix/.rw-store=rw:/nix/.ro-store=ro" ];
|
options = [
|
||||||
|
"lowerdir=/nix/.ro-store"
|
||||||
|
"upperdir=/nix/.rw-store/store"
|
||||||
|
"workdir=/nix/.rw-store/work"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "squashfs" ];
|
boot.initrd.availableKernelModules = [ "squashfs" "overlay" ];
|
||||||
|
|
||||||
boot.initrd.kernelModules = [ "loop" ];
|
boot.initrd.kernelModules = [ "loop" "overlay" ];
|
||||||
|
|
||||||
# Closures to be copied to the Nix store, namely the init
|
# Closures to be copied to the Nix store, namely the init
|
||||||
# script and the top-level system configuration directory.
|
# script and the top-level system configuration directory.
|
||||||
|
@ -334,8 +334,10 @@ mountFS() {
|
|||||||
|
|
||||||
# Filter out x- options, which busybox doesn't do yet.
|
# Filter out x- options, which busybox doesn't do yet.
|
||||||
local optionsFiltered="$(IFS=,; for i in $options; do if [ "${i:0:2}" != "x-" ]; then echo -n $i,; fi; done)"
|
local optionsFiltered="$(IFS=,; for i in $options; do if [ "${i:0:2}" != "x-" ]; then echo -n $i,; fi; done)"
|
||||||
|
# Prefix (lower|upper|work)dir with /mnt-root (overlayfs)
|
||||||
|
local optionsPrefixed="$( echo "$optionsFiltered" | sed -E 's#\<(lowerdir|upperdir|workdir)=#\1=/mnt-root#g' )"
|
||||||
|
|
||||||
echo "$device /mnt-root$mountPoint $fsType $optionsFiltered" >> /etc/fstab
|
echo "$device /mnt-root$mountPoint $fsType $optionsPrefixed" >> /etc/fstab
|
||||||
|
|
||||||
checkFS "$device" "$fsType"
|
checkFS "$device" "$fsType"
|
||||||
|
|
||||||
@ -354,10 +356,11 @@ mountFS() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Create backing directories for unionfs-fuse.
|
# Create backing directories for overlayfs
|
||||||
if [ "$fsType" = unionfs-fuse ]; then
|
if [ "$fsType" = overlay ]; then
|
||||||
for i in $(IFS=:; echo ${options##*,dirs=}); do
|
for i in upper work; do
|
||||||
mkdir -m 0700 -p /mnt-root"${i%=*}"
|
dir="$( echo "$optionsPrefixed" | grep -o "${i}dir=[^,]*" )"
|
||||||
|
mkdir -m 0700 -p "${dir##*=}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user