This repository has no description
1{
2 lib,
3 inputs,
4 currentSystem,
5 hostpkgs ? { },
6}:
7
8let
9 mkRun =
10 { path, builder }:
11 args: command:
12 let
13 setup =
14 if args ? src then
15 ''
16 cp -r ${args.src} src
17 cd src
18 chmod -R u+w .
19 ''
20 else
21 "";
22 in
23 derivation (
24 {
25 system = currentSystem;
26 inherit builder;
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 ${builder} -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 wasmpkgs =
44 {
45 inherit lib inputs;
46 run = mkRun {
47 path = [
48 pkgs.busybox
49 pkgs.bash
50 ];
51 builder = "${pkgs.bash}/bin/bash";
52 };
53 }
54 // lib.packagesFromDirectoryRecursive {
55 callPackage = lib.callPackageWith pkgs;
56 directory = ./packages;
57 };
58 pkgs = wasmpkgs // hostpkgs;
59in
60wasmpkgs