diff --git a/.nixpkgs/config.nix b/.nixpkgs/config.nix index 5909189..8ab124c 100644 --- a/.nixpkgs/config.nix +++ b/.nixpkgs/config.nix @@ -9,5 +9,7 @@ otfcc = callPackage ./pkgs/otfcc/default.nix {}; iosevka = callPackage ./pkgs/iosevka/default.nix {}; + + imposevka = callPackage ./pkgs/iosevka/imposevka.nix {}; }; } diff --git a/.nixpkgs/pkgs/iosevka/imposevka-patcher/makefile b/.nixpkgs/pkgs/iosevka/imposevka-patcher/makefile new file mode 100644 index 0000000..3049ef4 --- /dev/null +++ b/.nixpkgs/pkgs/iosevka/imposevka-patcher/makefile @@ -0,0 +1,18 @@ +SRCFILES=$(shell ls src/) +SOURCES=$(addprefix src/,$(SRCFILES)) +TARGETS=$(addprefix dst/,$(subst iosevka-,imposevka-,$(SRCFILES))) +SOURCE_OTDS=$(addprefix tmp/,$(subst .ttf,.otd,$(SRCFILES))) +TARGET_OTDS=$(addprefix tmp/,$(subst iosevka-,imposevka-,$(subst .ttf,.otd,$(SRCFILES)))) + +all : $(TARGETS) + +tmp/nerd.otd : nerd.ttf + otfccdump $< -o $@ --glyph-name-prefix .2. --ignore-hints + +$(TARGETS) : dst/imposevka-%.ttf : tmp/imposevka-%.otd + @otfccbuild $< -o $@ --keep-average-char-width --ship + @echo Patched $@ +$(TARGET_OTDS) : tmp/imposevka-%.otd : merge.js tmp/iosevka-%.otd tmp/nerd.otd + @node $^ $@ +$(SOURCE_OTDS) : tmp/iosevka-%.otd : src/iosevka-%.ttf + @otfccdump $< -o $@ --glyph-name-prefix .1. \ No newline at end of file diff --git a/.nixpkgs/pkgs/iosevka/imposevka-patcher/merge.js b/.nixpkgs/pkgs/iosevka/imposevka-patcher/merge.js new file mode 100644 index 0000000..2370e4d --- /dev/null +++ b/.nixpkgs/pkgs/iosevka/imposevka-patcher/merge.js @@ -0,0 +1,13 @@ +var fs = require('fs'); +var orig = JSON.parse(fs.readFileSync(process.argv[2], 'utf-8')); +var patch = JSON.parse(fs.readFileSync(process.argv[3], 'utf-8')); +for(var k in patch.cmap) { + if(!orig.cmap[k]) { orig.cmap[k] = patch.cmap[k] } +} +for(var k in patch.glyf) { + if(!orig.glyf[k]) { orig.glyf[k] = patch.glyf[k] } +} +for(var j = 0; j < orig.name.length; j++){ + orig.name[j].nameString = orig.name[j].nameString.replace(/Iosevka/g, 'Imposevka'); +} +fs.writeFileSync(process.argv[4], JSON.stringify(orig)) \ No newline at end of file diff --git a/.nixpkgs/pkgs/iosevka/imposevka-patcher/nerd.ttf b/.nixpkgs/pkgs/iosevka/imposevka-patcher/nerd.ttf new file mode 100644 index 0000000..3c98297 Binary files /dev/null and b/.nixpkgs/pkgs/iosevka/imposevka-patcher/nerd.ttf differ diff --git a/.nixpkgs/pkgs/iosevka/imposevka.nix b/.nixpkgs/pkgs/iosevka/imposevka.nix new file mode 100644 index 0000000..a6b8c21 --- /dev/null +++ b/.nixpkgs/pkgs/iosevka/imposevka.nix @@ -0,0 +1,33 @@ +{ stdenv, otfcc, iosevka, nodejs-6_x }: + +stdenv.mkDerivation rec { + name = "imposevka-${iosevka.version}"; + + src = ./imposevka-patcher; + + nativeBuildInputs = [ otfcc nodejs-6_x ]; + + buildPhase = '' + mkdir src + mkdir dst + mkdir tmp + + cp -v ${iosevka}/share/fonts/truetype/iosevka-* src/ + make + ''; + + installPhase = '' + fontdir=$out/share/fonts/truetype + mkdir -p $fontdir + cp -v dst/* $fontdir + ''; + + meta = with stdenv.lib; { + homepage = "https://github.com/ryanoasis/nerd-fonts"; + description = '' + NerdFont patched Iosevka + ''; + platforms = platforms.all; + maintainers = [ maintainers.fmthoma ]; + }; +}