diff --git a/modules/installer/cd-dvd/iso-image.nix b/modules/installer/cd-dvd/iso-image.nix index 8c0008771bb..c9d443441e3 100644 --- a/modules/installer/cd-dvd/iso-image.nix +++ b/modules/installer/cd-dvd/iso-image.nix @@ -194,25 +194,14 @@ in boot.initrd.availableKernelModules = [ "squashfs" "iso9660" ]; - boot.initrd.kernelModules = [ "loop" "fuse" ]; + boot.initrd.kernelModules = [ "loop" ]; 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 # /nix/store (the squashfs image) to make this a live CD. boot.initrd.postMountCommands = '' - # Hacky!!! fuse hard-codes the path to mount - 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 @@ -318,7 +307,7 @@ in ''; # Add vfat support to the initrd to enable people to copy the - # contents of the CD to a bootable USB stick. - boot.initrd.supportedFilesystems = [ "vfat" ]; + # contents of the CD to a bootable USB stick. Need unionfs-fuse for union mounts + boot.initrd.supportedFilesystems = [ "vfat" "unionfs-fuse" ]; } diff --git a/modules/module-list.nix b/modules/module-list.nix index 467eac6e00e..ae5e5d5c49f 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -214,6 +214,7 @@ ./tasks/filesystems/ext.nix ./tasks/filesystems/nfs.nix ./tasks/filesystems/reiserfs.nix + ./tasks/filesystems/unionfs-fuse.nix ./tasks/filesystems/vfat.nix ./tasks/filesystems/xfs.nix ./tasks/kbd.nix diff --git a/modules/tasks/filesystems/unionfs-fuse.nix b/modules/tasks/filesystems/unionfs-fuse.nix new file mode 100644 index 00000000000..48cf798c7f0 --- /dev/null +++ b/modules/tasks/filesystems/unionfs-fuse.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + config = pkgs.lib.mkIf (pkgs.lib.any (fs: fs == "unionfs-fuse") config.boot.initrd.supportedFilesystems) { + boot.initrd.kernelModules = [ "fuse" ]; + + boot.initrd.extraUtilsCommands = '' + cp -v ${pkgs.fuse}/lib/libfuse* $out/lib + cp -v ${pkgs.unionfs-fuse}/bin/unionfs $out/bin + ''; + + boot.initrd.postDeviceCommands = '' + # Hacky!!! fuse hard-codes the path to mount + 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 + ''; + }; +} diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index 982a6b6db45..8d50da8296c 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -252,16 +252,12 @@ in boot.initrd.availableKernelModules = [ "cifs" "nls_utf8" "hmac" "md4" "ecb" "des_generic" ]; - # unionfs-fuse expects fuse to be loaded - boot.initrd.kernelModules = optional cfg.writableStore [ "fuse" ]; + boot.initrd.supportedFilesystems = optional cfg.writableStore "unionfs-fuse"; boot.initrd.extraUtilsCommands = '' # We need mke2fs in the initrd. cp ${pkgs.e2fsprogs}/sbin/mke2fs $out/bin - '' + optionalString cfg.writableStore '' - cp -v ${pkgs.fuse}/lib/libfuse* $out/lib - cp -v ${pkgs.unionfs-fuse}/bin/unionfs $out/bin ''; boot.initrd.postDeviceCommands = @@ -290,11 +286,6 @@ in mkdir -p $targetRoot/boot mount -o remount,ro $targetRoot/nix/store ${optionalString cfg.writableStore '' - # Hacky!!! fuse hard-codes the path to mount - 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