From 7c27d012ae4d9906c601098c61f444fbe326c04a Mon Sep 17 00:00:00 2001 From: "Wael M. Nasreddine" Date: Thu, 19 Aug 2021 14:36:20 -0700 Subject: [PATCH] onlykey: parse the version from package.json --- pkgs/tools/security/onlykey/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/security/onlykey/default.nix b/pkgs/tools/security/onlykey/default.nix index 2ac033ba24b1..4cad7e513acd 100644 --- a/pkgs/tools/security/onlykey/default.nix +++ b/pkgs/tools/security/onlykey/default.nix @@ -9,8 +9,18 @@ }: let + # parse the version from package.json + version = + let + packageJson = builtins.fromJSON (builtins.readFile ./package.json); + splits = builtins.split "^.*#v(.*)$" (builtins.getAttr "onlykey" (builtins.head packageJson)); + matches = builtins.elemAt splits 1; + elem = builtins.head matches; + in + elem; + # this must be updated anytime this package is updated. - onlykeyPkg = "onlykey-git://github.com/trustcrypto/OnlyKey-App.git#v5.3.3"; + onlykeyPkg = "onlykey-git://github.com/trustcrypto/OnlyKey-App.git#v${version}"; # define a shortcut to get to onlykey. onlykey = self."${onlykeyPkg}";