Unverified Commit 53484a0b authored by Sizhe Zhao's avatar Sizhe Zhao Committed by GitHub
Browse files

openlist: 4.1.10 -> 4.2.1 (#509040)

parents be077cc5 dd64cb0a
Loading
Loading
Loading
Loading
+22 −19
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  buildNpmPackage,
  fetchFromGitHub,
  fetchPnpmDeps,
  fetchzip,

  nodejs,
  pnpm_9,
  fetchPnpmDeps,
  openlistPnpm ? pnpm_10,
  pnpmConfigHook,
  pnpm_10,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
buildNpmPackage (finalAttrs: {
  pname = "openlist-frontend";
  version = "4.1.10";
  version = "4.2.1";

  src = fetchFromGitHub {
    owner = "OpenListTeam";
    repo = "OpenList-Frontend";
    tag = "v${finalAttrs.version}";
    hash = "sha256-V8nfQsGLhd7eERF0/ly3sRdGmffYa9r6GhtjciOXxMU=";
    hash = "sha256-4WSL6j0dANUNlHFkMBb8j/KyNHWDQmLnC1y2FFJiBEI=";
  };

  i18n = fetchzip {
    url = "https://github.com/OpenListTeam/OpenList-Frontend/releases/download/v${finalAttrs.version}/i18n.tar.gz";
    hash = "sha256-VdNqXdLXs2n/ikUDm1YQRNAXqYqFjMWRGLPRpmJVoaI=";
    hash = "sha256-VzHNZh0ZA2FncAkyozHeBilN4KKsPqbpMESx4QCppW0=";
    stripRoot = false;
  };

  postPatch = ''
    cp -r ${finalAttrs.i18n}/* src/lang/
  '';

  nativeBuildInputs = [
    nodejs
    pnpmConfigHook
    pnpm_9
    openlistPnpm
  ];

  npmDeps = null;
  pnpmDeps = fetchPnpmDeps {
    inherit (finalAttrs) pname version src;
    pnpm = pnpm_9;
    fetcherVersion = 2;
    hash = "sha256-xylF+Z7Fkx/bFYPlzqfGrl051ZLKzPgdlF7U8vKtQq8=";
    pnpm = openlistPnpm;
    fetcherVersion = 3;
    hash = "sha256-rTDk1p568AKim+ZD00uq1q4XNNMeUFL1rGDBWx2C6DQ=";
  };

  buildPhase = ''
    runHook preBuild

    cp -r ${finalAttrs.i18n}/* src/lang/
    pnpm build
  npmConfigHook = pnpmConfigHook;

    runHook postBuild
  '';
  # [plugin vite:legacy-generate-polyfill-chunk]
  # Error: getaddrinfo ENOTFOUND localhost
  __darwinAllowLocalNetworking = true;

  installPhase = ''
    runHook preInstall
@@ -62,5 +64,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    homepage = "https://github.com/OpenListTeam/OpenList-Frontend";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ moraxyc ];
    inherit (nodejs.meta) platforms;
  };
})
+17 −8
Original line number Diff line number Diff line
@@ -2,22 +2,24 @@
  lib,
  stdenv,
  buildGoModule,
  fetchFromGitHub,
  callPackage,
  fetchFromGitHub,
  iana-etc,
  installShellFiles,
  libredirect,
  versionCheckHook,
  fuse,
}:

buildGoModule (finalAttrs: {
  pname = "openlist";
  version = "4.1.10";
  version = "4.2.1";

  src = fetchFromGitHub {
    owner = "OpenListTeam";
    repo = "OpenList";
    tag = "v${finalAttrs.version}";
    hash = "sha256-+B3ea0LvzpRll9HpfEU6RkSgnQtVprSlrO+Tq07T0eQ=";
    hash = "sha256-9MDcAQh06W6mOhYpFR49bxvTTrIoJnKY9P3WRVWsujI=";
    # populate values that require us to use git. By doing this in postFetch we
    # can delete .git afterwards and maintain better reproducibility of the src.
    leaveDotGit = true;
@@ -33,7 +35,12 @@ buildGoModule (finalAttrs: {
  frontend = callPackage ./frontend.nix { };

  proxyVendor = true;
  vendorHash = "sha256-xUTTVejCDDMfzWdmtXiWcc0/hzhniZJcNzPFFFiNnJk=";
  vendorHash = "sha256-Ho9zVKdzpGKZ/ftJmidUkMBsN4qfvLa96Fg3ayTfYac=";

  nativeBuildInputs = [
    installShellFiles
  ]
  ++ lib.optional stdenv.hostPlatform.isDarwin libredirect.hook;

  buildInputs = [ fuse ];

@@ -56,6 +63,10 @@ buildGoModule (finalAttrs: {
    ldflags+=" -X github.com/OpenListTeam/OpenList/v4/internal/conf.GitCommit=$(<COMMIT)"
  '';

  preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
    export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/services=${iana-etc}/etc/services
  '';

  checkFlags =
    let
      # Skip tests that require network access
@@ -74,8 +85,6 @@ buildGoModule (finalAttrs: {
    in
    [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];

  nativeBuildInputs = [ installShellFiles ];

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    installShellCompletion --cmd OpenList \
      --bash <($out/bin/OpenList completion bash) \
@@ -86,9 +95,9 @@ buildGoModule (finalAttrs: {
    $out/bin/OpenList completion powershell > $out/share/powershell/OpenList.Completion.ps1
  '';

  doInstallCheck = true;
  # panic: open /etc/protocols: operation not permitted
  doInstallCheck = !stdenv.hostPlatform.isDarwin;
  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgram = "${placeholder "out"}/bin/OpenList";
  versionCheckProgramArg = "version";

  passthru.updateScript = lib.getExe (callPackage ./update.nix { });