ubifs.nix (856B)
1 { 2 config, 3 pkgs, 4 lib, 5 ... 6 }: 7 let 8 inherit (lib) mkIf mkOption types; 9 o = config.system.outputs; 10 in 11 { 12 imports = [ 13 ./initramfs.nix 14 ]; 15 16 config = mkIf (config.rootfsType == "ubifs") { 17 kernel.config = { 18 MTD_UBI = "y"; 19 UBIFS_FS = "y"; 20 UBIFS_FS_SECURITY = "n"; 21 }; 22 boot.initramfs.enable = true; 23 system.outputs = { 24 rootfs = 25 let 26 inherit (pkgs.pkgsBuildBuild) runCommand mtdutils; 27 cfg = config.hardware.ubi; 28 in 29 runCommand "mkfs.ubifs" 30 { 31 depsBuildBuild = [ mtdutils ]; 32 } 33 '' 34 mkdir tmp 35 tree=${o.bootablerootdir} 36 mkfs.ubifs -x favor_lzo -c ${cfg.maxLEBcount} -m ${cfg.minIOSize} -e ${cfg.logicalEraseBlockSize} -y -r $tree --output $out --squash-uids -o $out 37 ''; 38 }; 39 }; 40 }