liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

configuration.nix (1367B)


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