Unverified Commit 9f032104 authored by Kenichi Kamiya's avatar Kenichi Kamiya
Browse files

prs: modernize

* Prefer `tag` over `rev` in `fetchFromGitLab`
* Add `versionCheckHook`
* Prefer `finalAttrs` over `rec`
* Add updateScript
parent 631818fd
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -10,16 +10,18 @@
  gtk3,
  stdenv,
  writableTmpDirAsHomeHook,
  versionCheckHook,
  nix-update-script,
}:

rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "prs";
  version = "0.5.4";

  src = fetchFromGitLab {
    owner = "timvisee";
    repo = "prs";
    rev = "refs/tags/v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-RWquV2apUazgGiwzTc0cMzKNItJOBZDSRMp13k+mhS0=";
  };

@@ -54,10 +56,18 @@ rustPlatform.buildRustPackage rec {
    done
  '';

  nativeInstallCheckInputs = [
    versionCheckHook
  ];
  doInstallCheck = true;
  versionCheckProgramArg = "--version";

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Secure, fast & convenient password manager CLI using GPG and git to sync";
    homepage = "https://gitlab.com/timvisee/prs";
    changelog = "https://gitlab.com/timvisee/prs/-/blob/v${version}/CHANGELOG.md";
    changelog = "https://gitlab.com/timvisee/prs/-/blob/v${finalAttrs.version}/CHANGELOG.md";
    license = with lib.licenses; [
      lgpl3Only # lib
      gpl3Only # everything else
@@ -65,4 +75,4 @@ rustPlatform.buildRustPackage rec {
    maintainers = with lib.maintainers; [ colemickens ];
    mainProgram = "prs";
  };
}
})