Berk D. Demir 9592011964 _1password-gui: Add passthru.updateScript
For Linux updates we use Repology API to observe 1Password's Arch User Repository.
For Darwin updates, 1Password for Mac 8's autoupdate feed URL.
2025-06-12 22:16:47 -07:00

69 lines
1.5 KiB
Nix

{
stdenv,
callPackage,
channel ? "stable",
fetchurl,
lib,
# This is only relevant for Linux, so we need to pass it through
polkitPolicyOwners ? [ ],
}:
let
pname = "1password";
hostOs = stdenv.hostPlatform.parsed.kernel.name;
hostArch = stdenv.hostPlatform.parsed.cpu.name;
sources = builtins.fromJSON (builtins.readFile ./sources.json);
sourcesChan = sources.${channel} or (throw "unsupported channel ${channel}");
sourcesChanOs = sourcesChan.${hostOs} or (throw "unsupported OS ${hostOs}");
sourcesChanOsArch =
sourcesChanOs.sources.${hostArch} or (throw "unsupported architecture ${hostArch}");
inherit (sourcesChanOs) version;
src = fetchurl {
inherit (sourcesChanOsArch) url hash;
};
meta = {
description = "Multi-platform password manager";
homepage = "https://1password.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [
khaneliman
timstott
savannidgerinel
sebtm
bdd
];
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
mainProgram = "1password";
};
in
if stdenv.hostPlatform.isDarwin then
callPackage ./darwin.nix {
inherit
pname
version
src
meta
;
}
else
callPackage ./linux.nix {
inherit
pname
version
src
meta
polkitPolicyOwners
;
}