Commit eb649889 authored by emaryn's avatar emaryn Committed by emaryn
Browse files

jotta-cli: 0.15.107955 -> 0.16.129390

parent 7da77d50
Loading
Loading
Loading
Loading
+24 −19
Original line number Diff line number Diff line
@@ -3,40 +3,45 @@
  stdenv,
  fetchzip,
  nixosTests,
  installShellFiles,
}:

let
  arch = "amd64";
in
stdenv.mkDerivation rec {
  pname = "jotta-cli";
  version = "0.15.107955";
  version = "0.16.129390";

  src = fetchzip {
    url = "https://repo.jotta.us/archives/linux/${arch}/jotta-cli-${version}_linux_${arch}.tar.gz";
    sha256 = "sha256-qCG3yi0ACmqOnn+gaCN8GedciUobpOww50Kz5AdknqU=";
    url = "https://repo.jotta.us/archives/linux/amd64/jotta-cli-${version}_linux_amd64.tar.gz";
    hash = "sha256-iw8OZ6clpK+CnBFNK5jOSGQ3ReU4pnOQSJFE2LTJNxE=";
    stripRoot = false;
  };

  installPhase = ''
    install -D usr/bin/jotta-cli usr/bin/jottad -t $out/bin/
    mkdir -p $out/share/bash-completion/completions
  '';
  nativeBuildInputs = [ installShellFiles ];

  installPhase =
    ''
      runHook preInstall

      install -Dm0755 usr/bin/jotta-cli usr/bin/jottad -t $out/bin/

  postFixup = ''
    patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $out/bin/jotta-cli
    patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $out/bin/jottad
    $out/bin/jotta-cli completion bash > $out/share/bash-completion/completions/jotta-cli.bash
      runHook postInstall
    ''
    + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
      installShellCompletion --cmd jotta-cli \
        --bash <($out/bin/jotta-cli completion bash) \
        --fish <($out/bin/jotta-cli completion fish) \
        --zsh <($out/bin/jotta-cli completion zsh)
    '';

  passthru.tests = { inherit (nixosTests) jotta-cli; };

  meta = with lib; {
  meta = {
    description = "Jottacloud CLI";
    homepage = "https://www.jottacloud.com/";
    downloadPage = "https://repo.jotta.us/archives/linux/";
    maintainers = with maintainers; [ evenbrenden ];
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    license = licenses.unfree;
    maintainers = with lib.maintainers; [ evenbrenden ];
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    license = lib.licenses.unfree;
    platforms = [ "x86_64-linux" ];
  };
}