LovelaceAcademy / nix-templates

Minimal reproducible nix flake templates
MIT License
14 stars 2 forks source link

move from http-serve to a standalone service to improve performance #145

Closed github-actions[bot] closed 11 months ago

github-actions[bot] commented 1 year ago

https://api.github.com/LovelaceAcademy/nix-templates/blob/0294d2f59bc09f1a21c1203b44e9fb3ac0970e02/hor-plutus/nix/serve-docs.nix#L51


inputs: context:
let
  inherit (context) pkgs;
  inherit (pkgs) lib;
  pickHsPkgs = attrs: hsPkgs: builtins.intersectAttrs
    (
      lib.attrsets.genAttrs attrs (_: true)
    )
    hsPkgs;

in
{ hsPkgs, additionalPkgs ? [ ] }:
let
  b = builtins;
  inherit (context) system;
  # TODO find a way to get plutus packages from plutus input to deduplicate logic
  plutus-pkgs = [
    "plutus-benchmark"
    "plutus-conformance"
    # FIXME plutus-core doc is not building
    #"plutus-core"
    "plutus-errors"
    "plutus-ledger-api"
    "plutus-metatheory"
    "plutus-tx"
    "plutus-tx-plugin"
    # FIXME plutus-script-utils doc is not building
    #"plutus-script-utils"
    "prettyprinter-configurable"
    "word-array"
  ];
  plutus-hsPkgs = pickHsPkgs plutus-pkgs hsPkgs;
  extra-hsPkgs = pickHsPkgs additionalPkgs hsPkgs;
  hsPkgs' = plutus-hsPkgs // extra-hsPkgs;
  combine-haddock = inputs.plutus.${system}.plutus.library.combine-haddock
    {
      inherit (pkgs) ghc;
      hspkgs = b.map
        pkgs.haskell.lib.doHaddock
        (b.attrValues hsPkgs');
      prologue = pkgs.writeTextFile {
        name = "prologue";
        text = "Combined documentation for the project and plutus dependencies";
      };
    };

in
pkgs.writeShellApplication {
  name = "serve-docs";
  runtimeInputs = [
    # TODO move from http-serve to a standalone service to improve performance
    pkgs.nodejs
    combine-haddock
  ];
  text = "npx http-serve ${combine-haddock}/share/doc -o";
}
github-actions[bot] commented 11 months ago

Closed in c399739d1aeaa1ace1b8759d9c32b4b56c1b66b9

github-actions[bot] commented 11 months ago

Closed in c399739d1aeaa1ace1b8759d9c32b4b56c1b66b9