From 6b31fa5d24df2949c7987f6fa349e6ef86e2fc00 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 1 Oct 2021 21:48:11 +0530 Subject: rework builds to use nix flakes --- .gitignore | 1 + build.sh | 46 ---------------------------------------------- flake.lock | 44 ++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 18 ++++++++---------- ligature_plugins/README.md | 2 +- 5 files changed, 54 insertions(+), 57 deletions(-) delete mode 100755 build.sh create mode 100644 flake.lock diff --git a/.gitignore b/.gitignore index 9d44be5..989802b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ build/ BitsNPicas.jar .envrc result +.direnv diff --git a/build.sh b/build.sh deleted file mode 100755 index 19d3175..0000000 --- a/build.sh +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/env bash - -ff_filter() { - fontforge -c 'open(argv[1]).generate(argv[2])' "$1" "$2" -} - -ttf_filter() { - # 1 - source file - # 2 - destination file - BNP=${BNP:="./BitsNPicas.jar"} - java -jar "$BNP" convertbitmap -f ttf -o "$2" "$1" -} - -export_fonts() { - for i in src/*; do - local file_name - file_name=$(basename "${i%.*}") - ttf_filter "$i" "build/scientifica/ttf/$file_name.ttf" - ff_filter "$i" "build/scientifica/otb/$file_name.otb" - ff_filter "$i" "build/scientifica/bdf/$file_name.bdf" - done -} - -export_plugins() { - cp -r ligature_plugins build/scientifica/ligature_plugins -} - -main() { - rm -rf build - mkdir -p build/scientifica/{otb,ttf,bdf} - - echo "[~] Exporting ligature plugins ..." - export_plugins - - echo "[~] Exporting fonts ..." - export_fonts - - echo "[~] Entering build directory ..." - cd build || echo "[!] Failed to enter build directory!" - tar c --file scientifica.tar scientifica - echo "[~] Leaving build directory ..." - - echo "[!] Done!" -} - -main diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5010a6d --- /dev/null +++ b/flake.lock @@ -0,0 +1,44 @@ +{ + "nodes": { + "bitsnpicas-src": { + "flake": false, + "locked": { + "lastModified": 1632715939, + "narHash": "sha256-7QnQeKEAQry1aSXqmgwwTnuXVroUdpo+8t6aJhfO+1I=", + "owner": "kreativekorp", + "repo": "bitsnpicas", + "rev": "b47896afe02a381f5e76871a8c7da0ce50d76a99", + "type": "github" + }, + "original": { + "owner": "kreativekorp", + "repo": "bitsnpicas", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1632918953, + "narHash": "sha256-XY3TKBfhP7wCu/SeqrwIkTWkyYHy5W1yRR8pxyzRY9Y=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ee90403e147b181300dffca5b0afa405e14f1945", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "bitsnpicas-src": "bitsnpicas-src", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index cb2c04c..ee909ef 100644 --- a/flake.nix +++ b/flake.nix @@ -33,26 +33,23 @@ overlay = final: prev: rec { bitsnpicas = with final; pkgs.writeScriptBin "bitsnpicas" '' - ${jdk}/bin/java -jar ${bitsnpicas-src}/downloads/BitsNPicas.jar + ${jdk}/bin/java -jar ${bitsnpicas-src}/downloads/BitsNPicas.jar "$@" ''; scientifica = with final; pkgs.stdenvNoCC.mkDerivation { pname = "scientifica"; version = "v2.3"; - src = ./.; + src = ./src; buildPhase = '' runHook preBuild - fontforge=${pkgs.fontforge}/bin/fontforge - bitsnpicas=${self.packages.bitsnpicas}/bin/bitsnpicas - ff_filter() { - fontforge -c 'open(argv[1]).generate(argv[2])' "$@" + ${pkgs.fontforge}/bin/fontforge -c 'open(argv[1]).generate(argv[2])' "$@" } ttf_filter() { - bitsnpicas convertbitmap -f ttf -o "$2" "$1" + ${pkgs.bitsnpicas}/bin/bitsnpicas convertbitmap -f ttf -o "$2" "$1" } mkdir -p $out/{ttf,otb,bdf} @@ -68,14 +65,15 @@ ff_filter "$i" "$out/bdf/$file_name.bdf" done - # copy ligature plugins - cp -r $src/ligature_plugins $out/ligature_plugins - popd runHook postBuild ''; + installPhase = '' + true + ''; + }; }; diff --git a/ligature_plugins/README.md b/ligature_plugins/README.md index 7173d61..75c6963 100644 --- a/ligature_plugins/README.md +++ b/ligature_plugins/README.md @@ -15,7 +15,7 @@ mkdir -p ~/.vim/after/syntax cp ligature_plugins/rust.vim ~/.vim/after/syntax/ ``` -If you have `set conceallevel=0` if your `vimrc`, remove it. +If you have `set conceallevel=0` in your `vimrc`, remove it. Big thanks to [romeovs](https://github.com/romeovs/) for creating the haskell plugin and the idea of ligatures via -- cgit v1.2.3