mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
onlykey: init at 5.3.3
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
parent
3861de4289
commit
f4498d1118
6 changed files with 7825 additions and 0 deletions
82
pkgs/tools/security/onlykey/default.nix
Normal file
82
pkgs/tools/security/onlykey/default.nix
Normal file
|
@ -0,0 +1,82 @@
|
|||
{ fetchgit
|
||||
, lib
|
||||
, makeDesktopItem
|
||||
, node_webkit
|
||||
, pkgs
|
||||
, runCommand
|
||||
, stdenv
|
||||
, writeShellScript
|
||||
}:
|
||||
|
||||
let
|
||||
# this must be updated anytime this package is updated.
|
||||
onlykeyPkg = "onlykey-git://github.com/trustcrypto/OnlyKey-App.git#v5.3.3";
|
||||
|
||||
# define a shortcut to get to onlykey.
|
||||
onlykey = self."${onlykeyPkg}";
|
||||
|
||||
super = (import ./onlykey.nix {
|
||||
inherit pkgs;
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
});
|
||||
|
||||
# extract the nw dependency out of the computed
|
||||
nwDependency = builtins.head (builtins.filter (d: d.packageName == "nw") onlykey.dependencies);
|
||||
|
||||
# In order to satisfy nw's installation of nwjs, create a directory that
|
||||
# includes the tarball or zipfile and place it at a location the installation
|
||||
# script will look for it.
|
||||
#
|
||||
# Reference:
|
||||
# https://github.com/nwjs/npm-installer/blob/4e65f25c5c1f119ab2c79aefea1020db7be38bc7/scripts/install.js#L37-L52
|
||||
#
|
||||
nwjsBase =
|
||||
let
|
||||
name =
|
||||
if stdenv.isLinux then "nwjs-v${nwDependency.version}-linux-x64"
|
||||
else if stdenv.isDarwin then "nwjs-v${nwDependency.version}-osx-x64"
|
||||
else throw "platform not supported";
|
||||
|
||||
command =
|
||||
if stdenv.isLinux then "${pkgs.gnutar}/bin/tar --dereference -czf $out/${nwDependency.version}/${name}.tar.gz ${name}"
|
||||
else if stdenv.isDarwin then ""
|
||||
else throw "platform not supported";
|
||||
in
|
||||
runCommand "nwjs-base" { } ''
|
||||
mkdir -p $out/${nwDependency.version}
|
||||
ln -s ${pkgs.nwjs}/share/nwjs ${name}
|
||||
${command}
|
||||
'';
|
||||
|
||||
self = super // {
|
||||
"${onlykeyPkg}" = super."${onlykeyPkg}".override (attrs: {
|
||||
# See explanation above regarding the nwjsBase.
|
||||
NWJS_URLBASE = "file://${nwjsBase}/";
|
||||
|
||||
# this is needed to allow us to parse the version of the nw dependency
|
||||
passthru = { inherit (attrs) dependencies; };
|
||||
|
||||
# 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
|
||||
''
|
5
pkgs/tools/security/onlykey/generate.sh
Executable file
5
pkgs/tools/security/onlykey/generate.sh
Executable 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
|
7716
pkgs/tools/security/onlykey/node-packages.nix
generated
Normal file
7716
pkgs/tools/security/onlykey/node-packages.nix
generated
Normal file
File diff suppressed because it is too large
Load diff
17
pkgs/tools/security/onlykey/onlykey.nix
Normal file
17
pkgs/tools/security/onlykey/onlykey.nix
Normal 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;
|
||||
}
|
3
pkgs/tools/security/onlykey/package.json
Normal file
3
pkgs/tools/security/onlykey/package.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
[
|
||||
{"onlykey": "git://github.com/trustcrypto/OnlyKey-App.git#v5.3.3"}
|
||||
]
|
|
@ -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; };
|
||||
|
||||
|
|
Loading…
Reference in a new issue