Unverified Commit 42caa1d0 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

fmd-server: 1.13.0 -> 1.14.1 (#502650)

parents 238c7bc6 6c0eb16a
Loading
Loading
Loading
Loading
+87 −31
Original line number Diff line number Diff line
@@ -2,23 +2,38 @@
  lib,
  buildGoModule,
  fetchFromGitLab,
  fetchPnpmDeps,
  nix-update-script,
  nodejs,
  pnpm,
  pnpmConfigHook,
  stdenv,
  versionCheckHook,
}:
buildGoModule (
  finalAttrs:
  let
  version = "0.13.0";
    inherit (finalAttrs.finalPackage.passthru) ui;
  in
buildGoModule {
  {
    pname = "fmd-server";
  inherit version;
    version = "0.14.1";
    src = fetchFromGitLab {
      owner = "fmd-foss";
      repo = "fmd-server";
    tag = "v${version}";
    hash = "sha256-pIVsdoen45YWG/V8qW/DE/yet4o+8MqpVHgHh70Fty8=";
      tag = "v${finalAttrs.version}";
      hash = "sha256-UmiYtriLC9qztv7nW+1tFpYv9I0NAOsApAJWP72OINg=";
    };

    pnpmDeps = fetchPnpmDeps {
      inherit (ui) pname;
      inherit pnpm;
      sourceRoot = "${finalAttrs.src.name}/${ui.pnpmRoot}";
      fetcherVersion = 3;
      hash = "sha256-fgqNaFQ4+uJxXzDJJq+D0+EFaLaYR+WUzi5kGq5ezjs=";
    };

  vendorHash = "sha256-d8QP6k7vEX0jBcpIMZymgOFYyKqGhND4Xa+mANg172s=";
    vendorHash = "sha256-cFIg9mOSQbrYHW4kg4aTeTaF+gy1jNpAlg8qepb81Jc=";

    nativeInstallCheckInputs = [ versionCheckHook ];
    versionCheckProgramArg = "version";
@@ -26,13 +41,54 @@ buildGoModule {
    doInstallCheck = true;
    passthru.updateScript = nix-update-script { };

    passthru.ui = stdenv.mkDerivation {
      inherit (finalAttrs) version src pnpmDeps;
      pname = "${finalAttrs.pname}-web-ui";

      pnpmRoot = "web";
      distRoot = "dist";

      nativeBuildInputs = [
        nodejs
        pnpmConfigHook
        pnpm
      ];

      buildPhase = ''
        runHook preBuild

        pushd web
        pnpm build
        popd

        runHook postBuild
      '';

      installPhase = ''
        runHook preInstall

        mkdir -p "$out"
        cp -r '${ui.pnpmRoot}/${ui.distRoot}' "$out"

        runHook postInstall
      '';
    };

    postUnpack = ''
      cp -r ${ui}/${ui.distRoot} /build/source/web/
    '';

    meta = {
      description = "Server to communicate with the FindMyDevice app and save the latest (encrypted) location";
      homepage = "https://fmd-foss.org/";
      downloadPage = "https://gitlab.com/fmd-foss/fmd-server";
      license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ j0hax ];
      maintainers = with lib.maintainers; [
        j0hax
        jthulhu
      ];
      teams = [ lib.teams.ngi ];
      mainProgram = "fmd-server";
    };
  }
)