iosevka: 1.4.3 -> 2.3.0

Use node2nix instead of reading package lock.
This commit is contained in:
babariviere 2019-09-15 19:36:10 +02:00
parent 659adfaf27
commit 41b98797ae
No known key found for this signature in database
GPG Key ID: EECF965F5AAA4E1A
7 changed files with 4309 additions and 3192 deletions

@ -1,5 +1,5 @@
{
stdenv, lib,
stdenv, lib, pkgs,
fetchFromGitHub, fetchurl,
nodejs, ttfautohint-nox, otfcc,
@ -21,7 +21,8 @@ assert (family != null) -> set != null;
assert (weights != []) -> set != null;
let
installPackageLock = import ./package-lock.nix { inherit fetchurl lib; };
system = builtins.currentSystem;
nodePackages = import ./node-packages.nix { inherit pkgs system nodejs; };
in
let pname = if set != null then "iosevka-${set}" else "iosevka"; in
@ -54,6 +55,9 @@ let
(if family != null then "family=\"${family}\"" else null)
(param "weights" weights)
]);
installNodeModules = unlines (lib.mapAttrsToList
(name: value: "mkdir -p node_modules/${name}\n cp -r ${value.outPath}/lib/node_modules/. node_modules")
nodePackages);
in
stdenv.mkDerivation {
@ -61,20 +65,13 @@ stdenv.mkDerivation {
nativeBuildInputs = [ nodejs ttfautohint-nox otfcc ];
passAsFile = [ "installPackageLock" "config" "extraParameters" ];
installPackageLock = installPackageLock ./package-lock.json;
passAsFile = [ "config" "extraParameters" ];
config = config;
extraParameters = extraParameters;
preConfigure = ''
HOME=$TMPDIR
source "$installPackageLockPath";
npm --offline rebuild
'';
configurePhase = ''
runHook preConfigure
mkdir -p node_modules/.bin
${installNodeModules}
${optionalString (set != null) ''mv "$configPath" private-build-plans.toml''}
${optionalString (extraParameters != null) ''cat "$extraParametersPath" >> parameters.toml''}
'';

@ -0,0 +1,6 @@
#!/bin/sh
node2nix --nodejs-10 --input node-packages.json \
--output node-packages-generated.nix \
--composition node-packages.nix \
--node-env ./../../../development/node-packages/node-env.nix

File diff suppressed because it is too large Load Diff

@ -0,0 +1,20 @@
[
"caryll-shapeops",
"libspiro-js",
"megaminx",
"object-assign",
"otfcc-ttcize",
"primitive-quadify-off-curves",
"toml",
"topsort",
"ttf2woff",
"ttf2woff2",
"unorm",
"verda",
"yargs",
"colors",
"patel",
"patrisika-scopes",
"eslint",
"stylus"
]

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

File diff suppressed because it is too large Load Diff

@ -1,143 +0,0 @@
{ lib, fetchurl }:
with lib; with builtins;
let
# Convert a base64-encoded string into a list of quads and padding.
fromBase64 = str:
let
len = stringLength str;
quads = 3 * len - 4 * padding;
padding =
if hasSuffix "==" str then 2 else
if hasSuffix "=" str then 1 else
0;
chars = stringToCharacters (substring 0 (len - padding) str);
table = {
A = [0 0 0];
B = [0 0 1];
C = [0 0 2];
D = [0 0 3];
E = [0 1 0];
F = [0 1 1];
G = [0 1 2];
H = [0 1 3];
I = [0 2 0];
J = [0 2 1];
K = [0 2 2];
L = [0 2 3];
M = [0 3 0];
N = [0 3 1];
O = [0 3 2];
P = [0 3 3];
Q = [1 0 0];
R = [1 0 1];
S = [1 0 2];
T = [1 0 3];
U = [1 1 0];
V = [1 1 1];
W = [1 1 2];
X = [1 1 3];
Y = [1 2 0];
Z = [1 2 1];
a = [1 2 2];
b = [1 2 3];
c = [1 3 0];
d = [1 3 1];
e = [1 3 2];
f = [1 3 3];
g = [2 0 0];
h = [2 0 1];
i = [2 0 2];
j = [2 0 3];
k = [2 1 0];
l = [2 1 1];
m = [2 1 2];
n = [2 1 3];
o = [2 2 0];
p = [2 2 1];
q = [2 2 2];
r = [2 2 3];
s = [2 3 0];
t = [2 3 1];
u = [2 3 2];
v = [2 3 3];
w = [3 0 0];
x = [3 0 1];
y = [3 0 2];
z = [3 0 3];
"0" = [3 1 0];
"1" = [3 1 1];
"2" = [3 1 2];
"3" = [3 1 3];
"4" = [3 2 0];
"5" = [3 2 1];
"6" = [3 2 2];
"7" = [3 2 3];
"8" = [3 3 0];
"9" = [3 3 1];
"+" = [3 3 2];
"/" = [3 3 3];
};
in
take quads (concatMap (c: table.${c}) chars);
# Convert a list of quads with padding into a base16-encoded string.
toBase16 = quads:
if length quads == 0 then "" else
if length quads == 1 then throw "toBase16: odd quads" else
let
hexad = 4 * elemAt quads 0 + elemAt quads 1;
hexits = "0123456789abcdef";
in
substring hexad 1 hexits + toBase16 (drop 2 quads);
in
let
fetchResolved = { resolved, integrity, ... }:
let args = { url = resolved; } // integrityHash integrity; in
fetchurl args;
integrityHash = integrity:
if hasPrefix "sha1-" integrity then integritySHA1 integrity else
if hasPrefix "sha512-" integrity then integritySHA512 integrity else
throw "don't understand integrity: ${integrity}";
integritySHA1 = integrity:
{ sha1 = toBase16 (fromBase64 (removePrefix "sha1-" integrity)); };
integritySHA512 = integrity:
{ sha512 = toBase16 (fromBase64 (removePrefix "sha512-" integrity)); };
in
let
depend = name: attrs@{ version, dependencies ? {}, ... }:
{
inherit name version;
src = fetchResolved attrs;
depends = mapAttrsToList depend dependencies;
};
prepareDepend = { name, src, depends, ... }:
''
unpackFile '${src}'
mkdir -p $(dirname "${name}")
mv package '${name}'
mkdir -p '${name}/node_modules'
(
cd '${name}/node_modules'
${concatMapStrings prepareDepend depends}
)
'';
in
packageLockFile:
let
packageLock = fromJSON (readFile packageLockFile);
depends = mapAttrsToList depend packageLock.dependencies;
in
''
mkdir -p node_modules
(
cd node_modules
${concatMapStrings prepareDepend depends}
)
''