1 { config, pkgs, lib, ... }:
6 (lib.mkIf (config.boot.initrd.supportedFilesystems.unionfs-fuse or false) {
7 boot.initrd.kernelModules = [ "fuse" ];
9 boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
10 copy_bin_and_libs ${pkgs.fuse}/sbin/mount.fuse
11 copy_bin_and_libs ${pkgs.unionfs-fuse}/bin/unionfs
12 substitute ${pkgs.unionfs-fuse}/sbin/mount.unionfs-fuse $out/bin/mount.unionfs-fuse \
13 --replace '${pkgs.bash}/bin/bash' /bin/sh \
14 --replace '${pkgs.fuse}/sbin' /bin \
15 --replace '${pkgs.unionfs-fuse}/bin' /bin
16 chmod +x $out/bin/mount.unionfs-fuse
19 boot.initrd.postDeviceCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
20 # Hacky!!! fuse hard-codes the path to mount
21 mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.util-linux.name}-bin/bin
22 ln -s $(which mount) /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.util-linux.name}-bin/bin
23 ln -s $(which umount) /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.util-linux.name}-bin/bin
26 boot.initrd.systemd.extraBin = {
27 "mount.fuse" = "${pkgs.fuse}/bin/mount.fuse";
28 "unionfs" = "${pkgs.unionfs-fuse}/bin/unionfs";
29 "mount.unionfs-fuse" = pkgs.runCommand "mount.unionfs-fuse" {} ''
30 substitute ${pkgs.unionfs-fuse}/sbin/mount.unionfs-fuse $out \
31 --replace '${pkgs.bash}/bin/bash' /bin/sh \
32 --replace '${pkgs.fuse}/sbin' /bin \
33 --replace '${pkgs.unionfs-fuse}/bin' /bin
38 (lib.mkIf (config.boot.supportedFilesystems.unionfs-fuse or false) {
39 system.fsPackages = [ pkgs.unionfs-fuse ];