Help package a java app with available source code

Hello Nixers,

there is a language annotation software that I have been trying and failing to package for Nix. It is called ELAN and its source code can be found here:

https://www.mpi.nl/tools/elan/ELAN_6-9_src.zip

I tried following the maven recipe and this is what I have so far (note that the hash is wrong):

ELAN.nix

{ lib, fetchzip, jre, makeWrapper, maven }:

maven.buildMavenPackage rec {
pname = “ELAN”;
version = “6.9.0”;

src = fetchzip {
url = “Object not found!”;
sha256 = “CzAMPB+lmoT/BRSKuJ8zdVGitbEH2LK8ikBEb5KODbM=”;
};

mvnHash = “sha256-kLpjMj05uC94/5vGMwMlFzLKNFOKeyNvq/vmB6pHTAo=”;

nativeBuildInputs = [ makeWrapper ];

installPhase = ‘’
mkdir -p $out/bin $out/share/elan-6.9
install -Dm644 elan-6.9/target/elan.jar $out/share/elan-6.9

makeWrapper ${jre}/bin/java $out/bin/elan-6.9 \
  --add-flags "-jar $out/share/elan/elan-6.9.jar"

‘’;

meta = with lib; {
homepage = “https://www.mpi.nl”;
description = “ELAN language annotation software”;
platforms = platforms.linux;
};
}

Can anyone help me fix this?

Thanks a lot in advance

If you surround your code in triple backticks, optionally with a language name for syntax highlighting, you will get a formatted code block.

e.g.

```python
print('Hello World!')
```

gives:

print('Hello World!')

Here is your code in a code block:

ELAN.nix

{ lib, fetchzip, jre, makeWrapper, maven }:

maven.buildMavenPackage rec {
  pname = "ELAN";
  version = "6.9.0";

  src = fetchzip {
    url = "https://www.mpi.nl/tools/elan/ELAN_6-9_linux.tag.gz";
    sha256 = "CzAMPB+lmoT/BRSKuJ8zdVGitbEH2LK8ikBEb5KODbM=";
  };

  # mvnHash = "sha256-kLpjMj05uC94/5vGMwMlFzLKNFOKeyNvq/vmB6pHTAo=";

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    mkdir -p $out/bin $out/share/elan-6.9
    install -Dm644 elan-6.9/target/elan.jar $out/share/elan-6.9

    makeWrapper ${jre}/bin/java $out/bin/elan-6.9 \
      --add-flags "-jar $out/share/elan/elan-6.9.jar"
  '';

  meta = with lib; {
    homepage = "https://www.mpi.nl";
    description = "ELAN language annotation software";
    platforms = platforms.linux;
  };
}

What error have you been getting when trying to build the package?

I tried to help, as this package looks interesting, and got a little bit of progress with the expression:

{
  lib,
  fetchzip,
  maven,

  writableTmpDirAsHomeHook,
  makeWrapper,

  jre,
}:

maven.buildMavenPackage rec {
  pname = "ELAN";
  version = "6.9";

  src = fetchzip {
    # TODO: Use the version attribute to get the src url
    url = "https://www.mpi.nl/tools/elan/ELAN_6-9_src.zip";
    hash = "sha256-RIa08rTIqwIvMTDuOez48Sy7p9GfXAJejl2nRG5tP2c=";
  };
  nativeBuildInputs = [
    writableTmpDirAsHomeHook
    makeWrapper
  ];

  # mvnHash = "sha256-kLpjMj05uC94/5vGMwMlFzLKNFOKeyNvq/vmB6pHTAo=";

  # TODO: Use the version attribute to get the src url
  installPhase = ''
    mkdir -p $out/bin $out/share/elan-6.9
    install -Dm644 elan-6.9/target/elan.jar $out/share/elan-6.9

    makeWrapper ${jre}/bin/java $out/bin/elan-6.9 \
      --add-flags "-jar $out/share/elan/elan-6.9.jar"
  '';

  meta = {
    homepage = "https://archive.mpi.nl/tla/elan";
    changelog = "https://archive.mpi.nl/tla/elan/release-notes";
    description = "An annotation tool for audio and video recordings.";
    license = lib.licences.gpl3Plus;
  };
}

And I got very peculiar errors about data files not found. Indeed a very hard package to build.

Thanks a lot for the help! I really appreciate it! Now I get similar errors when I run your script as when I run mvn package.

This is the error:

[ERROR] DetachedFrameTest.testInstantiationWhenVideoFrameAlwaysOnTopPreferenceIsTrue:56 ? Headless No X11 DISPLAY variable was set, or no headful library support was found, but this program performed an operation which requires it,

Does anyone know where it could come from?