outputs.nix (2426B)
1 { 2 config 3 , pkgs 4 , lib 5 , ... 6 }: 7 let 8 inherit (lib) mkOption types concatStringsSep; 9 inherit (pkgs) liminix callPackage writeText; 10 in 11 { 12 imports = [ 13 ./squashfs.nix 14 ]; 15 options = { 16 system.outputs = { 17 kernel = mkOption { 18 type = types.package; 19 description = '' 20 Kernel vmlinux file (usually ELF) 21 ''; 22 }; 23 dtb = mkOption { 24 type = types.package; 25 description = '' 26 Compiled device tree (FDT) for the target device 27 ''; 28 }; 29 uimage = mkOption { 30 type = types.package; 31 description = '' 32 Combined kernel and FDT in uImage (U-Boot compatible) format 33 ''; 34 }; 35 vmroot = mkOption { 36 type = types.package; 37 description = '' 38 Directory containing separate kernel and rootfs image for 39 use with qemu (see mips-vm) 40 ''; 41 }; 42 manifest = mkOption { 43 type = types.package; 44 description = '' 45 Debugging aid. JSON rendition of config.filesystem, on 46 which can run "nix-store -q --tree" on it and find 47 out what's in the image, which is nice if it's unexpectedly huge 48 ''; 49 }; 50 rootfs = mkOption { 51 type = types.package; 52 description = '' 53 root filesystem (squashfs or jffs2) image 54 ''; 55 internal = true; 56 }; 57 }; 58 }; 59 config = { 60 system.outputs = rec { 61 # tftpd = pkgs.buildPackages.tufted; 62 kernel = liminix.builders.kernel.override { 63 inherit (config.kernel) config src extraPatchPhase; 64 }; 65 dtb = (callPackage ../kernel/dtb.nix {}) { 66 inherit (config.boot) commandLine; 67 dts = config.hardware.dts.src; 68 includes = config.hardware.dts.includes ++ [ 69 "${kernel.headers}/include" 70 ]; 71 }; 72 uimage = (callPackage ../kernel/uimage.nix {}) { 73 commandLine = concatStringsSep " " config.boot.commandLine; 74 inherit (config.hardware) loadAddress entryPoint; 75 inherit kernel; 76 inherit dtb; 77 }; 78 vmroot = pkgs.runCommand "qemu" {} '' 79 mkdir $out 80 cd $out 81 ln -s ${config.system.outputs.rootfs} rootfs 82 ln -s ${kernel} vmlinux 83 ln -s ${manifest} manifest 84 ln -s ${kernel.headers} build 85 ''; 86 87 manifest = writeText "manifest.json" (builtins.toJSON config.filesystem.contents); 88 }; 89 }; 90 }