/ packages / dusk-stdlib / default.nix
default.nix
 1  {
 2    callPackage,
 3    lib,
 4    symlinkJoin,
 5    writeShellApplication,
 6  }:
 7  let
 8    inherit (builtins) attrValues concatStringsSep;
 9  
10    namespace = "dusk-stdlib";
11  
12    entrypoint =
13      let
14        destinations = map (p: "${p}/${p.destination}") (attrValues packages);
15        load = dest: ''echo ". ${dest}"'';
16      in
17      writeShellApplication {
18        name = "dusk-stdlib-load";
19        text = ''
20          ${concatStringsSep "\n" (map load destinations)}
21        '';
22      };
23  
24    packages = {
25      log = callPackage ./log { inherit namespace; };
26    };
27  in
28  symlinkJoin {
29    name = namespace;
30  
31    paths = (attrValues packages) ++ [ entrypoint ];
32    passthru = packages // {
33      inherit entrypoint;
34    };
35  
36    meta = with lib; {
37      description = "A much needed standard library for the Bourne Again Shell";
38      license = licenses.mit;
39      platforms = platforms.all;
40    };
41  }