Unverified Commit 424e662c authored by Emily's avatar Emily Committed by GitHub
Browse files

openbao.ui: Fix and cleanup package (#478004)

parents 0d1e61f7 3b50b853
Loading
Loading
Loading
Loading
+25 −6
Original line number Diff line number Diff line
@@ -2,33 +2,52 @@
  stdenvNoCC,
  openbao,
  yarn-berry_3,
  nodejs,
  nodejs_22,
}:
let

  yarn = yarn-berry_3.override { nodejs = nodejs_22; };

in
stdenvNoCC.mkDerivation (finalAttrs: {
  pname = openbao.pname + "-ui";
  inherit (openbao) version src;
  sourceRoot = "${finalAttrs.src.name}/ui";

  offlineCache = yarn-berry_3.fetchYarnBerryDeps {
  offlineCache = yarn.fetchYarnBerryDeps {
    inherit (finalAttrs) src sourceRoot;
    hash = "sha256-ZG/br4r2YzPPgsysx7MBy1WtUBkar1U84nkKecZ5bvU=";
  };

  nativeBuildInputs = [
    yarn-berry_3.yarnBerryConfigHook
    nodejs
    yarn-berry_3
    yarn.yarnBerryConfigHook
    nodejs_22
    yarn
  ];

  env.YARN_ENABLE_SCRIPTS = 0;

  preConfigure = ''
    printYarnErrors() {
      cat /build/*.log
    }
    failureHooks+=(printYarnErrors)
  '';

  postConfigure = ''
    substituteInPlace .ember-cli \
      --replace-fail "../http/web_ui" "$out"
  '';

  buildPhase = "yarn run ember build --environment=production";
  buildPhase = ''
    runHook preBuild
    yarn run ember build --environment=production
    runHook postBuild
  '';

  dontInstall = true;

  meta = (builtins.removeAttrs openbao.meta [ "mainProgram" ]) // {
    description = openbao.meta.description + " - web UI";
  };
})