Unverified Commit fb4eccca authored by Adrian Perez's avatar Adrian Perez
Browse files

sonarr: add packaging info

Upstream provides `PackageAuthor` and `PackageVersion` to packages,
docker images, etc. This is presumably to help with debugging, and
considering how much this package has diverged from upstream, we should
provide this info.

In addition, there are some assumptions in code that Sonarr is always
running from a directory called "bin", this hasn't been the case with
this package, was resolved by moving the .NET output into the proper
dir. 
parent 2740b264
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -62,6 +62,8 @@ buildDotnetModule {
  pname = "sonarr";
  inherit version src;

  # Upstream expects to be ran from a "bin" directory
  installPath = "${placeholder "out"}/lib/sonarr/bin";
  strictDeps = true;
  nativeBuildInputs = [
    nodejs
@@ -87,12 +89,18 @@ buildDotnetModule {
    yarn --offline run build --env production
  '';
  postInstall =
    let
      packageInfo = writers.writeText "package_info" ''
        PackageVersion=${version}
        PackageAuthor=[NixOS](https://nixos.org)
      '';
    in
    lib.optionalString withFFmpeg ''
      rm -- "$out/lib/sonarr/ffprobe"
      ln -s -- "$ffprobe" "$out/lib/sonarr/ffprobe"
      ln -sf -- "$ffprobe" "$out/lib/sonarr/bin/ffprobe"
    ''
    + ''
      cp -a -- _output/UI "$out/lib/sonarr/UI"
      cp -a -- _output/UI "$out/lib/sonarr/bin/UI"
      ln -s ${packageInfo} $out/lib/sonarr/package_info
    '';
  # Add an alias for compatibility with Sonarr v3 package.
  postFixup = ''