Merge pull request #213481 from lunik1/iosevka-buildnpmpackage

iosevka: use buildNpmPackage
This commit is contained in:
Thomas Tuegel 2023-01-31 10:39:21 -06:00 committed by GitHub
commit e1e1b192c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 2787 deletions

View file

@ -1,4 +1,10 @@
{ stdenv, lib, pkgs, fetchFromGitHub, nodejs, remarshal
{ stdenv
, lib
, pkgs
, buildNpmPackage
, fetchFromGitHub
, nodejs
, remarshal
, ttfautohint-nox
# Custom font set options.
# See https://typeof.net/Iosevka/customizer
@ -42,70 +48,57 @@
# '';
, extraParameters ? null
# Custom font set name. Required if any custom settings above.
, set ? null }:
, set ? null
}:
assert (privateBuildPlan != null) -> set != null;
assert (extraParameters != null) -> set != null;
let
# We don't know the attribute name for the Iosevka package as it
# changes not when our update script is run (which in turn updates
# node-packages.json, but when node-packages/generate.sh is run
# (which updates node-packages.nix).
#
# Doing it this way ensures that the package can always be built,
# although possibly an older version than ioseva-bin.
nodeIosevka = (import ./node-composition.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
}).package.override {
src = fetchFromGitHub {
owner = "be5invis";
repo = "Iosevka";
rev = "v15.6.3";
hash = "sha256-wsFx5sD1CjQTcmwpLSt97OYFI8GtVH54uvKQLU1fWTg=";
};
buildNpmPackage rec {
pname = if set != null then "iosevka-${set}" else "iosevka";
version = "17.1.0";
src = fetchFromGitHub {
owner = "be5invis";
repo = "iosevka";
rev = "v${version}";
hash = "sha256-xGRymDhkNP9b2JYTEu4M/CrRINmMGY2S5ZuM3Ot1wGg=";
};
in
stdenv.mkDerivation rec {
pname = if set != null then "iosevka-${set}" else "iosevka";
inherit (nodeIosevka) version src;
npmDepsHash = "sha256-Ncf07ggyOnz/2SpgdmaYS2X/8Bad+J2sz8Yyx9Iri3E=";
nativeBuildInputs = [
nodejs
remarshal
ttfautohint-nox
];
nativeBuildInputs = [ nodejs remarshal ttfautohint-nox ];
buildPlan =
if builtins.isAttrs privateBuildPlan
then builtins.toJSON { buildPlans.${pname} = privateBuildPlan; }
else privateBuildPlan;
if builtins.isAttrs privateBuildPlan then
builtins.toJSON { buildPlans.${pname} = privateBuildPlan; }
else
privateBuildPlan;
inherit extraParameters;
passAsFile = [
"extraParameters"
] ++ lib.optionals (! (builtins.isString privateBuildPlan && lib.hasPrefix builtins.storeDir privateBuildPlan)) [
"buildPlan"
];
passAsFile = [ "extraParameters" ] ++ lib.optionals
(
!(builtins.isString privateBuildPlan
&& lib.hasPrefix builtins.storeDir privateBuildPlan)
) [ "buildPlan" ];
configurePhase = ''
runHook preConfigure
${lib.optionalString (builtins.isAttrs privateBuildPlan) ''
remarshal -i "$buildPlanPath" -o private-build-plans.toml -if json -of toml
''}
${lib.optionalString (builtins.isString privateBuildPlan && (!lib.hasPrefix builtins.storeDir privateBuildPlan)) ''
cp "$buildPlanPath" private-build-plans.toml
''}
${lib.optionalString (builtins.isString privateBuildPlan && (lib.hasPrefix builtins.storeDir privateBuildPlan)) ''
cp "$buildPlan" private-build-plans.toml
''}
${lib.optionalString (builtins.isString privateBuildPlan
&& (!lib.hasPrefix builtins.storeDir privateBuildPlan)) ''
cp "$buildPlanPath" private-build-plans.toml
''}
${lib.optionalString (builtins.isString privateBuildPlan
&& (lib.hasPrefix builtins.storeDir privateBuildPlan)) ''
cp "$buildPlan" private-build-plans.toml
''}
${lib.optionalString (extraParameters != null) ''
echo -e "\n" >> params/parameters.toml
cat "$extraParametersPath" >> params/parameters.toml
''}
ln -s ${nodeIosevka}/lib/node_modules/iosevka/node_modules .
runHook postConfigure
'';
@ -126,16 +119,13 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
passthru = {
updateScript = ./update-default.sh;
};
meta = with lib; {
homepage = "https://be5invis.github.io/Iosevka";
homepage = "https://typeof.net/Iosevka/";
downloadPage = "https://github.com/be5invis/Iosevka/releases";
description = ''
Slender monospace sans-serif and slab-serif typeface inspired by Pragmata
Pro, M+ and PF DIN Mono, designed to be the ideal font for programming.
Iosevka is an open-source, sans-serif + slab-serif, monospace +
quasiproportional typeface family, designed for writing code, using in
terminals, and preparing technical documents.
'';
license = licenses.ofl;
platforms = platforms.all;
@ -146,6 +136,7 @@ stdenv.mkDerivation rec {
babariviere
rileyinman
AluisioASG
lunik1
];
};
}

View file

@ -1,17 +0,0 @@
# This file has been generated by node2nix 1.11.1. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-16_x"}:
let
nodeEnv = import ../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
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;
}

File diff suppressed because it is too large Load diff

View file

@ -1,21 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts coreutils gawk replace
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
nixpkgs=../../../..
repo=https://github.com/be5invis/Iosevka
# Discover the latest version.
current_version=$(nix-instantiate "$nixpkgs" --eval --strict -A iosevka.version | tr -d '"')
new_version=$(list-git-tags --url="$repo" | sort --reverse --version-sort | awk 'match($0, /^v([0-9.]+)$/, m) { print m[1]; exit; }')
if [[ "$new_version" == "$current_version" ]]; then
echo "iosevka: no update found"
exit
fi
# Update the source package in nodePackages.
current_source="$repo/archive/v$current_version.tar.gz"
new_source="$repo/archive/v$new_version.tar.gz"
replace-literal -ef "$current_source" "$new_source" ../../../development/node-packages/node-packages.json
echo "iosevka: $current_version -> $new_version (after nodePackages update)"

View file

@ -183,7 +183,6 @@
, "insect"
, "intelephense"
, "ionic"
, {"iosevka": "https://github.com/be5invis/Iosevka/archive/v17.1.0.tar.gz"}
, "jake"
, "javascript-typescript-langserver"
, "joplin"