Commit c3b6a251 authored by ZHAO Jin-Xiang's avatar ZHAO Jin-Xiang
Browse files

lipo-go: use finalAttrs style

parent 2e1ad6b7
Loading
Loading
Loading
Loading
+6 −19
Original line number Diff line number Diff line
@@ -2,37 +2,26 @@
  lib,
  buildGoModule,
  fetchFromGitHub,
  ast-grep,
  versionCheckHook,
  nix-update-script,
  lipo-go,
}:
buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "lipo-go";
  version = "0.10.0";

  src = fetchFromGitHub {
    owner = "konoui";
    repo = "lipo";
    tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-V1KlgCNKvxnY/B8cmiWFdXzHH6k6VmhNMIta3nckXtA=";
  };
  vendorHash = "sha256-7M6CRxJd4fgYQLJDkNa3ds3f7jOp3dyloOZtwMtCBQk=";

  nativeBuildInputs = [ ast-grep ];

  postPatch =
    # Remove the test case that is not compatible with nix-build
    ''
      ast-grep run \
        --pattern 'func TestLipo_ArchsToLocalFiles($$$) { $$$ }' \
        --rewrite "" \
        pkg/lipo/archs_test.go
    '';
  buildPhase = ''
    runHook preBuild

    make build VERSION=${version} REVISION="" BINARY=$out/bin/lipo
    make build VERSION=${finalAttrs.version} REVISION="" BINARY=$out/bin/lipo

    runHook postBuild
  '';
@@ -44,16 +33,14 @@ buildGoModule rec {
  versionCheckProgramArg = "-version";
  doInstallCheck = true;

  passthru = {
    updateScript = nix-update-script { };
  };
  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Designed to be compatible with macOS lipo, written in golang";
    homepage = "https://github.com/konoui/lipo";
    changelog = "https://github.com/konoui/lipo/releases/tag/v${version}";
    changelog = "https://github.com/konoui/lipo/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ xiaoxiangmoe ];
    mainProgram = "lipo";
  };
}
})