at 25.11-pre 1.8 kB view raw
1{ 2 config, 3 pkgs, 4 lib, 5 ... 6}: 7 8{ 9 config = lib.mkMerge [ 10 11 (lib.mkIf (config.boot.initrd.supportedFilesystems.unionfs-fuse or false) { 12 boot.initrd.kernelModules = [ "fuse" ]; 13 14 boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) '' 15 copy_bin_and_libs ${pkgs.fuse}/sbin/mount.fuse 16 copy_bin_and_libs ${pkgs.unionfs-fuse}/bin/unionfs 17 substitute ${pkgs.unionfs-fuse}/sbin/mount.unionfs-fuse $out/bin/mount.unionfs-fuse \ 18 --replace '${pkgs.bash}/bin/bash' /bin/sh \ 19 --replace '${pkgs.fuse}/sbin' /bin \ 20 --replace '${pkgs.unionfs-fuse}/bin' /bin 21 chmod +x $out/bin/mount.unionfs-fuse 22 ''; 23 24 boot.initrd.postDeviceCommands = lib.mkIf (!config.boot.initrd.systemd.enable) '' 25 # Hacky!!! fuse hard-codes the path to mount 26 mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.util-linux.name}-bin/bin 27 ln -s $(which mount) /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.util-linux.name}-bin/bin 28 ln -s $(which umount) /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.util-linux.name}-bin/bin 29 ''; 30 31 boot.initrd.systemd.extraBin = { 32 "mount.fuse" = "${pkgs.fuse}/bin/mount.fuse"; 33 "unionfs" = "${pkgs.unionfs-fuse}/bin/unionfs"; 34 "mount.unionfs-fuse" = pkgs.runCommand "mount.unionfs-fuse" { } '' 35 substitute ${pkgs.unionfs-fuse}/sbin/mount.unionfs-fuse $out \ 36 --replace '${pkgs.bash}/bin/bash' /bin/sh \ 37 --replace '${pkgs.fuse}/sbin' /bin \ 38 --replace '${pkgs.unionfs-fuse}/bin' /bin 39 ''; 40 }; 41 }) 42 43 (lib.mkIf (config.boot.supportedFilesystems.unionfs-fuse or false) { 44 system.fsPackages = [ pkgs.unionfs-fuse ]; 45 }) 46 47 ]; 48}