aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-01 17:18:11 +0100
committerAkshay <[email protected]>2021-10-01 17:20:12 +0100
commit6b31fa5d24df2949c7987f6fa349e6ef86e2fc00 (patch)
tree3acbdde2aa3b80e6a22b4d781efd5cd0d598028b
parent3bad67b25652306f49b77deb3f176eff73876632 (diff)
rework builds to use nix flakesv2.3
-rw-r--r--.gitignore1
-rwxr-xr-xbuild.sh46
-rw-r--r--flake.lock44
-rw-r--r--flake.nix18
-rw-r--r--ligature_plugins/README.md2
5 files changed, 54 insertions, 57 deletions
diff --git a/.gitignore b/.gitignore
index 9d44be5..989802b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ build/
10BitsNPicas.jar 10BitsNPicas.jar
11.envrc 11.envrc
12result 12result
13.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 @@
1#! /usr/bin/env bash
2
3ff_filter() {
4 fontforge -c 'open(argv[1]).generate(argv[2])' "$1" "$2"
5}
6
7ttf_filter() {
8 # 1 - source file
9 # 2 - destination file
10 BNP=${BNP:="./BitsNPicas.jar"}
11 java -jar "$BNP" convertbitmap -f ttf -o "$2" "$1"
12}
13
14export_fonts() {
15 for i in src/*; do
16 local file_name
17 file_name=$(basename "${i%.*}")
18 ttf_filter "$i" "build/scientifica/ttf/$file_name.ttf"
19 ff_filter "$i" "build/scientifica/otb/$file_name.otb"
20 ff_filter "$i" "build/scientifica/bdf/$file_name.bdf"
21 done
22}
23
24export_plugins() {
25 cp -r ligature_plugins build/scientifica/ligature_plugins
26}
27
28main() {
29 rm -rf build
30 mkdir -p build/scientifica/{otb,ttf,bdf}
31
32 echo "[~] Exporting ligature plugins ..."
33 export_plugins
34
35 echo "[~] Exporting fonts ..."
36 export_fonts
37
38 echo "[~] Entering build directory ..."
39 cd build || echo "[!] Failed to enter build directory!"
40 tar c --file scientifica.tar scientifica
41 echo "[~] Leaving build directory ..."
42
43 echo "[!] Done!"
44}
45
46main
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..5010a6d
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,44 @@
1{
2 "nodes": {
3 "bitsnpicas-src": {
4 "flake": false,
5 "locked": {
6 "lastModified": 1632715939,
7 "narHash": "sha256-7QnQeKEAQry1aSXqmgwwTnuXVroUdpo+8t6aJhfO+1I=",
8 "owner": "kreativekorp",
9 "repo": "bitsnpicas",
10 "rev": "b47896afe02a381f5e76871a8c7da0ce50d76a99",
11 "type": "github"
12 },
13 "original": {
14 "owner": "kreativekorp",
15 "repo": "bitsnpicas",
16 "type": "github"
17 }
18 },
19 "nixpkgs": {
20 "locked": {
21 "lastModified": 1632918953,
22 "narHash": "sha256-XY3TKBfhP7wCu/SeqrwIkTWkyYHy5W1yRR8pxyzRY9Y=",
23 "owner": "NixOS",
24 "repo": "nixpkgs",
25 "rev": "ee90403e147b181300dffca5b0afa405e14f1945",
26 "type": "github"
27 },
28 "original": {
29 "owner": "NixOS",
30 "ref": "nixos-21.05",
31 "repo": "nixpkgs",
32 "type": "github"
33 }
34 },
35 "root": {
36 "inputs": {
37 "bitsnpicas-src": "bitsnpicas-src",
38 "nixpkgs": "nixpkgs"
39 }
40 }
41 },
42 "root": "root",
43 "version": 7
44}
diff --git a/flake.nix b/flake.nix
index cb2c04c..ee909ef 100644
--- a/flake.nix
+++ b/flake.nix
@@ -33,26 +33,23 @@
33 overlay = final: prev: rec { 33 overlay = final: prev: rec {
34 34
35 bitsnpicas = with final; pkgs.writeScriptBin "bitsnpicas" '' 35 bitsnpicas = with final; pkgs.writeScriptBin "bitsnpicas" ''
36 ${jdk}/bin/java -jar ${bitsnpicas-src}/downloads/BitsNPicas.jar 36 ${jdk}/bin/java -jar ${bitsnpicas-src}/downloads/BitsNPicas.jar "[email protected]"
37 ''; 37 '';
38 38
39 scientifica = with final; pkgs.stdenvNoCC.mkDerivation { 39 scientifica = with final; pkgs.stdenvNoCC.mkDerivation {
40 pname = "scientifica"; 40 pname = "scientifica";
41 version = "v2.3"; 41 version = "v2.3";
42 src = ./.; 42 src = ./src;
43 43
44 buildPhase = '' 44 buildPhase = ''
45 runHook preBuild 45 runHook preBuild
46 46
47 fontforge=${pkgs.fontforge}/bin/fontforge
48 bitsnpicas=${self.packages.bitsnpicas}/bin/bitsnpicas
49
50 ff_filter() { 47 ff_filter() {
51 fontforge -c 'open(argv[1]).generate(argv[2])' "[email protected]" 48 ${pkgs.fontforge}/bin/fontforge -c 'open(argv[1]).generate(argv[2])' "[email protected]"
52 } 49 }
53 50
54 ttf_filter() { 51 ttf_filter() {
55 bitsnpicas convertbitmap -f ttf -o "$2" "$1" 52 ${pkgs.bitsnpicas}/bin/bitsnpicas convertbitmap -f ttf -o "$2" "$1"
56 } 53 }
57 54
58 mkdir -p $out/{ttf,otb,bdf} 55 mkdir -p $out/{ttf,otb,bdf}
@@ -68,14 +65,15 @@
68 ff_filter "$i" "$out/bdf/$file_name.bdf" 65 ff_filter "$i" "$out/bdf/$file_name.bdf"
69 done 66 done
70 67
71 # copy ligature plugins
72 cp -r $src/ligature_plugins $out/ligature_plugins
73
74 popd 68 popd
75 69
76 runHook postBuild 70 runHook postBuild
77 ''; 71 '';
78 72
73 installPhase = ''
74 true
75 '';
76
79 }; 77 };
80 78
81 }; 79 };
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
15cp ligature_plugins/rust.vim ~/.vim/after/syntax/ 15cp ligature_plugins/rust.vim ~/.vim/after/syntax/
16 ``` 16 ```
17 17
18If you have `set conceallevel=0` if your `vimrc`, remove it. 18If you have `set conceallevel=0` in your `vimrc`, remove it.
19 19
20Big thanks to [romeovs](https://github.com/romeovs/) for 20Big thanks to [romeovs](https://github.com/romeovs/) for
21creating the haskell plugin and the idea of ligatures via 21creating the haskell plugin and the idea of ligatures via