Unverified Commit 30e379cd authored by rnhmjoj's avatar rnhmjoj
Browse files

magnetico: unstable-2022-08-10 -> 0.12.1

Switched to a release of my own fork.
This fixes:

  - build on Go ≥ 1.22
  - database errors on sqlite ≥ 3.33
  - reproducibility
  - static build
parent 24a0f054
Loading
Loading
Loading
Loading
+15 −33
Original line number Diff line number Diff line
{ lib
, fetchFromGitHub
, fetchpatch
, nixosTests
, stdenv
, fetchFromGitea
, buildGoModule
, nixosTests
, sqlite
}:

buildGoModule {
buildGoModule rec {
  pname = "magnetico";
  version = "unstable-2022-08-10";
  version = "0.12.1";

  src = fetchFromGitHub {
    owner  = "ireun";
  src = fetchFromGitea {
    domain = "maxwell.ydns.eu/git";
    owner  = "rnhmjoj";
    repo   = "magnetico";
    rev    = "828e230d3b3c0759d3274e27f5a7b70400f4d6ea";
    hash   = "sha256-V1pBzillWTk9iuHAhFztxYaq4uLL3U3HYvedGk6ffbk=";
    rev    = "v${version}";
    hash   = "sha256-cO5TVtQ1jdW1YkFtj35kmRfJG46/lXjXyz870NCPT0g=";
  };

  patches = [
    # https://github.com/ireun/magnetico/pull/15
    (fetchpatch {
      url = "https://github.com/ireun/magnetico/commit/90db34991aa44af9b79ab4710c638607c6211c1c.patch";
      hash = "sha256-wC9lVQqfngQ5AaRgb4TtoWSgbQ2iSHeQ2UBDUyWjMK8=";
     })
  ];

  vendorHash = "sha256-JDrBXjnQAcWp8gKvnm+q1F5oV+FozKUvhHK/Me/Cyj8=";
  vendorHash = "sha256-jIVMQtPCq9RYaYsH4LSZJFspH6TpCbgzHN0GX8cM/CI=";

  buildInputs = [ sqlite ];

  buildPhase = ''
    runHook preBuild

    make magneticow magneticod

    runHook postBuild
  '';

  checkPhase = ''
    runHook preCheck

    make test
  tags = [ "fts5" "libsqlite3" ];
  ldflags = [ "-s" "-w" ];

    runHook postCheck
  '';
  doCheck = !stdenv.hostPlatform.isStatic;

  passthru.tests = { inherit (nixosTests) magnetico; };

  meta = with lib; {
    description  = "Autonomous (self-hosted) BitTorrent DHT search engine suite";
    homepage     = "https://github.com/ireun/magnetico";
    homepage     = "https://maxwell.ydns.eu/git/rnhmjoj/magnetico";
    license      = licenses.agpl3Only;
    badPlatforms = platforms.darwin;
    maintainers  = with maintainers; [ rnhmjoj ];