_1password: modernize; 2.29.0 -> 2.30.0 (#350504)

This commit is contained in:
Sefa Eyeoglu 2024-10-26 18:05:16 +02:00 committed by GitHub
commit 36ac8d7e41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 19 deletions

View File

@ -1,8 +1,19 @@
{ lib, stdenv, fetchurl, fetchzip, autoPatchelfHook, installShellFiles, cpio, xar, _1password, testers }:
{
lib,
stdenv,
fetchurl,
fetchzip,
autoPatchelfHook,
installShellFiles,
cpio,
xar,
versionCheckHook,
}:
let
inherit (stdenv.hostPlatform) system;
fetch = srcPlatform: hash: extension:
fetch =
srcPlatform: hash: extension:
let
args = {
url = "https://cache.agilebits.com/dist/1P/op2/pkg/v${version}/op_${srcPlatform}_v${version}.${extension}";
@ -12,12 +23,14 @@ let
if extension == "zip" then fetchzip args else fetchurl args;
pname = "1password-cli";
version = "2.29.0";
version = "2.30.0";
sources = rec {
aarch64-linux = fetch "linux_arm64" "sha256-sBbdkoacGI/gawM4YH+BBCLDhC2B+cE4iKVGHBhwkic=" "zip";
i686-linux = fetch "linux_386" "sha256-TTd5juT0Aqp1+OfunXcuk0KbL6HIHQV31+1Q1e0GYMY=" "zip";
x86_64-linux = fetch "linux_amd64" "sha256-Bb6fNoeNxlbDfwt7Jr8BaKCmFUwSdsLQdVoCmQCNmLA=" "zip";
aarch64-darwin = fetch "apple_universal" "sha256-/ryklZnGhrgJggDIa8HmuDsHAXkdrWeXKCQGGVwUAAo=" "pkg";
aarch64-linux = fetch "linux_arm64" "sha256-KNduqspTzLEHmymSefLnnhIBcIQWx2tshvOc0NwDek0=" "zip";
i686-linux = fetch "linux_386" "sha256-StdWtD3tz6bKqSem/GFqeRHzkbv4aP7d7dKKtgNhuY8=" "zip";
x86_64-linux = fetch "linux_amd64" "sha256-bzhRkpR3te1bcBEfP2BR6SECTC9sRFDshl7B+/278Kg=" "zip";
aarch64-darwin =
fetch "apple_universal" "sha256-L1SZWQWjAJDZydlAttbWLS7igZNAvOmIyaUUdVbvEa8="
"pkg";
x86_64-darwin = aarch64-darwin;
};
platforms = builtins.attrNames sources;
@ -32,9 +45,15 @@ stdenv.mkDerivation {
else
throw "Source for ${pname} is not available for ${system}";
nativeBuildInputs = [ installShellFiles ] ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
nativeBuildInputs = [
installShellFiles
versionCheckHook
] ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ xar cpio ];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
xar
cpio
];
unpackPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
xar -xf $src
@ -59,14 +78,11 @@ stdenv.mkDerivation {
doInstallCheck = true;
installCheckPhase = ''
$out/bin/${mainProgram} --version
'';
versionCheckProgram = "${builtins.placeholder "out"}/bin/${mainProgram}";
versionCheckProgramArg = [ "--version" ];
passthru.updateScript = ./update.sh;
passthru.tests.version = testers.testVersion {
package = _1password;
passthru = {
updateScript = ./update.sh;
};
meta = with lib; {

View File

@ -4,7 +4,7 @@
set -eu
ROOT="$(dirname "$(readlink -f "$0")")"
NIX_DRV="$ROOT/default.nix"
NIX_DRV="$ROOT/package.nix"
if [ ! -f "$NIX_DRV" ]; then
echo "ERROR: cannot find default.nix in $ROOT"
exit 1

View File

@ -1432,8 +1432,6 @@ with pkgs;
_3mux = callPackage ../tools/misc/3mux { };
_1password = callPackage ../applications/misc/1password { };
_1password-gui = callPackage ../applications/misc/1password-gui { };
_1password-gui-beta = callPackage ../applications/misc/1password-gui { channel = "beta"; };