1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

Merge pull request #134838 from kalbasit/opensource/nixpkgs/add-onlykey

onlykey: init at 5.3.3
This commit is contained in:
Wael Nasreddine 2021-08-20 09:21:52 -07:00 committed by GitHub
commit 68aa57afe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 7806 additions and 0 deletions

View file

@ -0,0 +1,63 @@
{ fetchgit
, lib
, makeDesktopItem
, node_webkit
, pkgs
, runCommand
, stdenv
, writeShellScript
}:
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#v${version}";
# define a shortcut to get to onlykey.
onlykey = self."${onlykeyPkg}";
super = (import ./onlykey.nix {
inherit pkgs;
inherit (stdenv.hostPlatform) system;
});
self = super // {
"${onlykeyPkg}" = super."${onlykeyPkg}".override (attrs: {
# when installing packages, nw tries to download nwjs in its postInstall
# script. There are currently no other postInstall scripts, so this
# should not break other things.
npmFlags = attrs.npmFlags or "" + " --ignore-scripts";
# this package requires to be built in order to become runnable.
postInstall = ''
cd $out/lib/node_modules/${attrs.packageName}
npm run build
'';
});
};
script = writeShellScript "${onlykey.packageName}-starter-${onlykey.version}" ''
${node_webkit}/bin/nw ${onlykey}/lib/node_modules/${onlykey.packageName}/build
'';
desktop = makeDesktopItem {
name = onlykey.packageName;
exec = script;
icon = "${onlykey}/lib/node_modules/${onlykey.packageName}/resources/onlykey_logo_128.png";
desktopName = onlykey.packageName;
genericName = onlykey.packageName;
};
in
runCommand "${onlykey.packageName}-${onlykey.version}" { } ''
mkdir -p $out/bin
ln -s ${script} $out/bin/onlykey
''

View file

@ -0,0 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nodePackages.node2nix
# XXX: --development is given here because we need access to gulp in order to build OnlyKey.
exec node2nix --nodejs-14 --development -i package.json -c onlykey.nix -e ../../../development/node-packages/node-env.nix --no-copy-node-env

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
# This file has been generated by node2nix 1.9.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}:
let
nodeEnv = import ../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
}

View file

@ -0,0 +1,3 @@
[
{"onlykey": "git://github.com/trustcrypto/OnlyKey-App.git#v5.3.3"}
]

View file

@ -7689,6 +7689,8 @@ with pkgs;
onlykey-cli = callPackage ../tools/security/onlykey-cli { };
onlykey = callPackage ../tools/security/onlykey { node_webkit = nwjs; };
openapi-generator-cli = callPackage ../tools/networking/openapi-generator-cli { jre = pkgs.jre_headless; };
openapi-generator-cli-unstable = callPackage ../tools/networking/openapi-generator-cli/unstable.nix { jre = pkgs.jre_headless; };