This repository has no description
1{
2 lib,
3 inputs,
4 currentSystem,
5 hostpkgs ? { },
6}:
7
8let
9 mkRun =
10 path: args: command:
11 let
12 setup =
13 if args ? src then
14 ''
15 mkdir src
16 cd src
17 cp -r ${args.src}/* .
18 chmod -R u+w .
19 ''
20 else
21 "";
22 in
23 derivation (
24 {
25 system = currentSystem;
26 builder = "${pkgs.busybox}/bin/ash";
27 args = [
28 "-euc"
29 ''
30 if [ 0 -eq "$NIX_BUILD_CORES" ]; then
31 NIX_BUILD_CORES=$(${pkgs.busybox}/bin/nproc)
32 fi
33 exec ${pkgs.busybox}/bin/ash -eux $commandPath
34 ''
35 ];
36 PATH = lib.makeBinPath ((args.path or [ ]) ++ path);
37 command = setup + "\n" + command;
38 passAsFile = [ "command" ];
39 }
40 // (removeAttrs args [ "srcPath" ])
41 );
42
43 run0 = mkRun [ pkgs.busybox ];
44
45 wasmpkgs =
46 {
47 inherit lib inputs;
48 sh = run0 { name = "sh"; } ''
49 mkdir -p $out/bin
50 ln -s ${pkgs.busybox}/bin/ash $out/bin/sh
51 '';
52 run = mkRun [
53 pkgs.busybox
54 pkgs.sh
55 ];
56 }
57 // lib.packagesFromDirectoryRecursive {
58 callPackage = lib.callPackageWith pkgs;
59 directory = ./packages;
60 };
61 pkgs = wasmpkgs // hostpkgs;
62in
63wasmpkgs