3
0
Fork 0
forked from mirrors/nixpkgs

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