Commit 173f38f6 authored by Florian Klink's avatar Florian Klink
Browse files

grafana-alloy: expose npmDeps separately

With this, nix-update is able to correctly update the frontend npm deps
hash.
parent 3ada6e2a
Loading
Loading
Loading
Loading
+20 −16
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchNpmDeps,
  buildGoModule,
  buildNpmPackage,
  systemd,
@@ -24,23 +25,26 @@ buildGoModule (finalAttrs: rec {
    hash = "sha256-DfezWaLbCty8FiFA+oEqiDoZ1QKIdYGtywQ6t2vm/N0=";
  };

  frontend =
    let
      fsrc = "${src}/internal/web/ui";
    in
    buildNpmPackage {
      pname = "alloy-frontend";
      inherit version;
  npmDeps = fetchNpmDeps {
    src = "${finalAttrs.src}/internal/web/ui";
    hash = "sha256-mEcPH+kuj+o60sK+JsRAwHauT7vHnZQZ+KBhKcDSeok=";
  };

      src = fsrc;
  frontend = buildNpmPackage {
    pname = "alloy-frontend";
    inherit version src;

      npmDepsHash = "sha256-mEcPH+kuj+o60sK+JsRAwHauT7vHnZQZ+KBhKcDSeok=";
    inherit npmDeps;
    sourceRoot = "${src.name}/internal/web/ui";

    installPhase = ''
      runHook preInstall

      mkdir $out
      cp -av dist $out/share
      '';

      runHook postInstall
    '';
  };

  proxyVendor = true;
@@ -126,8 +130,8 @@ buildGoModule (finalAttrs: rec {
        "v(.+)"
      ];
    };
    # alias for nix-update to be able to find and update this attribute
    inherit frontend;
    # for nix-update to be able to find and update the hash
    inherit npmDeps;
  };

  meta = {