{ stdenv, callPackage, channel ? "stable", fetchurl, lib, # This is only relevant for Linux, so we need to pass it through polkitPolicyOwners ? [ ], }: let pname = "1password"; version = if channel == "stable" then "8.10.40" else "8.10.44-21.BETA"; sources = { stable = { x86_64-linux = { url = "https://downloads.1password.com/linux/tar/stable/x86_64/1password-${version}.x64.tar.gz"; hash = "sha256-viY0SOUhrOvmue6Nolau356rIqwDo2nLzMilFFmNb9g="; }; aarch64-linux = { url = "https://downloads.1password.com/linux/tar/stable/aarch64/1password-${version}.arm64.tar.gz"; hash = "sha256-7lUZiS3TSsIVqPoN5A6YqyVaaaRI9BliT51FHkwOPyw="; }; x86_64-darwin = { url = "https://downloads.1password.com/mac/1Password-${version}-x86_64.zip"; hash = "sha256-xK/B8J3VP8y1xw3KorzZzPf/LjYmYdOIjDECMJnVv6I="; }; aarch64-darwin = { url = "https://downloads.1password.com/mac/1Password-${version}-aarch64.zip"; hash = "sha256-iqdK6K7dcypZFGseYal2KjOaqJtUjXeCzbDdx7pDv8A="; }; }; beta = { x86_64-linux = { url = "https://downloads.1password.com/linux/tar/beta/x86_64/1password-${version}.x64.tar.gz"; hash = "sha256-enorJfbn+xJVy1fG3wjhO3LkSsMncHA9/yA13kG+h4Y="; }; aarch64-linux = { url = "https://downloads.1password.com/linux/tar/beta/aarch64/1password-${version}.arm64.tar.gz"; hash = "sha256-EUnIIi6DB5kBVid9ExBpNApKItHnRKQziBy/GFt0xag="; }; x86_64-darwin = { url = "https://downloads.1password.com/mac/1Password-${version}-x86_64.zip"; hash = "sha256-U14CjoUJUpd4wWidZz6xGErhHI/VPChqG8cwBTBYoYc="; }; aarch64-darwin = { url = "https://downloads.1password.com/mac/1Password-${version}-aarch64.zip"; hash = "sha256-DD1M2EFSHqG9OHX5Q/CmZLZIKYrBMS4cnX/6tLVi7H0="; }; }; }; src = fetchurl { inherit (sources.${channel}.${stdenv.system} or (throw "unsupported system ${stdenv.hostPlatform.system}")) url hash ; }; meta = { # Requires to be installed in "/Application" which is not possible for now (https://github.com/NixOS/nixpkgs/issues/254944) broken = stdenv.hostPlatform.isDarwin; description = "Multi-platform password manager"; homepage = "https://1password.com/"; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = lib.licenses.unfree; maintainers = with lib.maintainers; [ timstott savannidgerinel sebtm ]; platforms = builtins.attrNames sources.${channel}; 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 ; }