12 # parse the version from package.json
15 packageJson = lib.importJSON ./package.json;
16 splits = builtins.split "^.*#v(.*)$" (builtins.getAttr "onlykey" (builtins.head packageJson));
17 matches = builtins.elemAt splits 1;
18 elem = builtins.head matches;
22 # this must be updated anytime this package is updated.
23 onlykeyPkg = "onlykey-git+https://github.com/trustcrypto/OnlyKey-App.git#v${version}";
25 # define a shortcut to get to onlykey.
26 onlykey = self."${onlykeyPkg}";
28 super = import ./onlykey.nix {
30 inherit (stdenv.hostPlatform) system;
34 "${onlykeyPkg}" = super."${onlykeyPkg}".override (attrs: {
35 # when installing packages, nw tries to download nwjs in its postInstall
36 # script. There are currently no other postInstall scripts, so this
37 # should not break other things.
38 npmFlags = attrs.npmFlags or "" + " --ignore-scripts";
40 # this package requires to be built in order to become runnable.
42 cd $out/lib/node_modules/${attrs.packageName}
48 script = writeShellScript "${onlykey.packageName}-starter-${onlykey.version}" ''
49 ${node_webkit}/bin/nw ${onlykey}/lib/node_modules/${onlykey.packageName}/build
53 pname = "${onlykey.packageName}";
54 inherit (onlykey) version;
56 nativeBuildInputs = [ wrapGAppsHook3 copyDesktopItems ];
59 name = onlykey.packageName;
61 icon = "${onlykey}/lib/node_modules/${onlykey.packageName}/resources/onlykey_logo_128.png";
62 desktopName = onlykey.packageName;
63 genericName = onlykey.packageName;
70 ln -s ${script} $out/bin/onlykey