~ehmry/sigil

6037605927422656eb095c5e0f6a86b66bfa16a5 — Emery Hemingway 1 year, 2 months ago 3d0fa7f
test-depot stuff
1 files changed, 100 insertions(+), 0 deletions(-)

A test-depot.nix
A test-depot.nix => test-depot.nix +100 -0
@@ 0,0 1,100 @@
let
  sigil = import ./.;
  pkgs = sigil.legacyPackages.x86_64-genode;
  inherit (pkgs) lib;
in rec {

  inherit (pkgs.genodePackages) syndicate_test;

  testLogBin = pkgs.sculptUtils.buildBinArchive pkgs.genodePackages.test-log;

  syndicateBin =
    pkgs.sculptUtils.buildBinArchive pkgs.genodePackages.syndicate_test;

  syndicatePkg = let pkg = pkgs.genodePackages.syndicate_test;
  in pkgs.sculptUtils.buildPkg {
    inherit (syndicateBin) pname;
    archives = [ "boarc/${syndicateBin.srcPath}" ];
    runtime = let
      inherit (lib.getErisMainProgram pkgs.genodePackages.syndicate_test)
        cap closure;
    in {
      binary = cap;
      caps = 128;
      ram = "4M";
      content = map ({ cap, path }: {
        tag = "rom";
        label = cap;
      }) closure;
      config = ''
        <config ld_verbose="true">
          <libc rtc="/dev/rtc" stderr="/dev/log" stdin="/dev/null" stdout="/dev/log"/>
          <vfs>
            <dir name="dev">
              <null/>
              <log/>
              <rtc/>
            </dir>
          </vfs>
        </config>
      '';
    };
  };

  testLogPkg = let pkg = pkgs.genodePackages.test-log;
  in pkgs.sculptUtils.buildPkg {
    inherit (testLogBin) pname;
    archives = [ "boarc/${testLogBin.srcPath}" ];
    runtime = let inherit (lib.getErisMainProgram pkg) cap closure;
    in {
      binary = (lib.getErisMainProgram pkg).cap;
      caps = 128;
      ram = "2M";
      content = map ({ cap, path }: {
        tag = "rom";
        label = cap;
      }) closure;
      config = ''
        <config ld_verbose="true"/>
      '';
    };
  };

  nano3dPkg = pkgs.sculptUtils.buildPkg {
    pname = "nano3d";
    archives = [ "genodelabs/src/nano3d/2023-04-25" ];
    runtime = {
      binary = "nano3d";
      caps = 200;
      ram = "4M";
      requires = [ { tag = "gui"; } { tag = "timer"; } ];
    };
  };

  index = pkgs.sculptUtils.buildIndex {
    release = "23.04";
    supportsArch = [ "x86_64" ];
    indexes = {
      Demos.pkgs = [
        {
          path = "boarc/${syndicatePkg.depotPath}";
          info = "Syndicate demo";
        }
        {
          path = "boarc/${testLogPkg.depotPath}";
          info = "Test log";
        }
      ];
      GUI.pkgs = [{
        path = "boarc/${nano3dPkg.depotPath}";
        info = "simple software-rendering demo";
      }];
    };
  };

  depot = pkgs.symlinkJoin {
    # TODO: compress at this step?
    name = "depot-boarc";
    paths = [ index nano3dPkg syndicateBin syndicatePkg ];
  };
}