configuration.nix (1445B)
1 { 2 config, 3 pkgs, 4 lib, 5 lim, 6 ... 7 }: 8 let 9 inherit (pkgs.pseudofile) dir; 10 dts = 11 pkgs.runCommand "qemu.dts" 12 { 13 nativeBuildInputs = with pkgs.pkgsBuildBuild; [ 14 dtc 15 qemu 16 ]; 17 } 18 '' 19 qemu-system-${pkgs.stdenv.hostPlatform.qemuArch} \ 20 -machine virt -machine dumpdtb=tmp.dtb 21 dtc -I dtb -O dts -o $out tmp.dtb 22 # https://stackoverflow.com/a/69890137, 23 # XXX try fdtput $out -p -t s /pl061@9030000 status disabled 24 # instead of using sed 25 sed -i $out -e 's/compatible = "arm,pl061.*/status = "disabled";/g' 26 ''; 27 in 28 { 29 imports = [ 30 ../../modules/outputs/ext4fs.nix 31 ../../modules/outputs/tftpboot.nix 32 ]; 33 34 config = { 35 hostname = "tftpboot-test"; 36 # use extracted dts if it was null in the device 37 # definition, use actual dts if provided 38 hardware.dts.src = lib.mkOverride 500 dts; 39 boot.tftp = { 40 loadAddress = 41 let 42 offsets = { 43 mips = "0x88000000"; 44 arm = "0x44000000"; 45 aarch64 = "0x44000000"; 46 }; 47 in 48 lim.parseInt offsets.${pkgs.stdenv.hostPlatform.qemuArch}; 49 serverip = "10.0.2.2"; 50 ipaddr = "10.0.2.15"; 51 }; 52 boot.imageFormat = "fit"; 53 rootfsType = "ext4"; 54 filesystem = dir { 55 hello = { 56 type = "f"; 57 uid = 7; 58 gid = 24; 59 file = "hello world"; 60 }; 61 }; 62 }; 63 }