From 189c45a12a7ace0ad4c8ebe2d3af225e098eaf21 Mon Sep 17 00:00:00 2001 From: Krzysztof Saczuk Date: Mon, 9 Sep 2024 11:28:12 +0200 Subject: [PATCH] feat(apps): switch `1password` to beta channel --- modules/desktop/apps/_1password.nix | 7 +++++- overlays/_1password.nix | 39 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 overlays/_1password.nix diff --git a/modules/desktop/apps/_1password.nix b/modules/desktop/apps/_1password.nix index 56d2963..32d51ac 100644 --- a/modules/desktop/apps/_1password.nix +++ b/modules/desktop/apps/_1password.nix @@ -2,6 +2,7 @@ config, lib, pkgs, + unstable, inputs, username, desktop, @@ -21,10 +22,14 @@ with lib.my.utils; let secrets = utils.readSecrets {inherit config base;}; in { programs = { - _1password.enable = true; + _1password = { + enable = true; + package = unstable._1password-beta; + }; _1password-gui = { enable = true; polkitPolicyOwners = [username]; + package = unstable._1password-gui-beta; }; fish.interactiveShellInit = '' diff --git a/overlays/_1password.nix b/overlays/_1password.nix new file mode 100644 index 0000000..c013d83 --- /dev/null +++ b/overlays/_1password.nix @@ -0,0 +1,39 @@ +{lib, ...}: +with lib; { + unstable = singleton (final: prev: { + _1password-beta = prev._1password.overrideAttrs (prevAttrs: let + inherit (prev) stdenv fetchurl fetchzip; + + inherit (stdenv.hostPlatform) system; + fetch = srcPlatform: hash: extension: let + args = + { + url = "https://cache.agilebits.com/dist/1P/op2/pkg/v${version}/op_${srcPlatform}_v${version}.${extension}"; + inherit hash; + } + // lib.optionalAttrs (extension == "zip") {stripRoot = false;}; + in + if extension == "zip" + then fetchzip args + else fetchurl args; + + pname = "1password-cli"; + version = "2.30.0-beta.03"; + sources = rec { + aarch64-linux = fetch "linux_arm64" "sha256-RvFlmgFrvrdlwAPYOJl9OGiUH4Cv0ZXw8YzwsS0LgHo=" "zip"; + i686-linux = fetch "linux_386" "sha256-8HEJp9SCrSv2EZ+AhNcFi9avig9OFUqy8+eCM4pb9NA=" "zip"; + x86_64-linux = fetch "linux_amd64" "sha256-7iaYCry3T9GD84GBX/A+IC27Ngq1WYGeYDV/yxMNamw=" "zip"; + aarch64-darwin = fetch "apple_universal" "sha256-0OyhQRAYXatOQ2dNYKIPUw/UO2QNn+GFILabXnsFgBA=" "pkg"; + x86_64-darwin = aarch64-darwin; + }; + platforms = builtins.attrNames sources; + in { + inherit pname version; + + src = + if (builtins.elem system platforms) + then sources.${system} + else throw "Source for ${pname} is not available for ${system}"; + }); + }); +}