aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-01 17:15:56 +0100
committerAkshay <[email protected]>2021-10-01 17:15:56 +0100
commit3bad67b25652306f49b77deb3f176eff73876632 (patch)
treebf0ffbe8f322ee55d2a57dfbb36ff9bf4185ca58 /flake.nix
parentfd8484a615a5480a918443ae323203c73f273065 (diff)
close #55, #51
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix90
1 files changed, 90 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..cb2c04c
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,90 @@
1{
2 description = "Scientifica: tall and condensed bitmap font for geeks";
3
4 inputs = {
5
6 nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
7
8 bitsnpicas-src = {
9 url = "github:kreativekorp/bitsnpicas";
10 flake = false;
11 };
12
13 };
14
15 outputs =
16 { self
17 , nixpkgs
18 , bitsnpicas-src
19 , ...
20 }:
21 let
22 supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
23 forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
24
25 nixpkgsFor = forAllSystems (system:
26 import nixpkgs {
27 inherit system;
28 overlays = [ self.overlay ];
29 });
30 in
31 {
32
33 overlay = final: prev: rec {
34
35 bitsnpicas = with final; pkgs.writeScriptBin "bitsnpicas" ''
36 ${jdk}/bin/java -jar ${bitsnpicas-src}/downloads/BitsNPicas.jar
37 '';
38
39 scientifica = with final; pkgs.stdenvNoCC.mkDerivation {
40 pname = "scientifica";
41 version = "v2.3";
42 src = ./.;
43
44 buildPhase = ''
45 runHook preBuild
46
47 fontforge=${pkgs.fontforge}/bin/fontforge
48 bitsnpicas=${self.packages.bitsnpicas}/bin/bitsnpicas
49
50 ff_filter() {
51 fontforge -c 'open(argv[1]).generate(argv[2])' "$@"
52 }
53
54 ttf_filter() {
55 bitsnpicas convertbitmap -f ttf -o "$2" "$1"
56 }
57
58 mkdir -p $out/{ttf,otb,bdf}
59
60 pushd $src
61
62 # generate font files
63 for i in *; do
64 local file_name
65 file_name="''${i%.*}"
66 ttf_filter "$i" "$out/ttf/$file_name.ttf"
67 ff_filter "$i" "$out/otb/$file_name.otb"
68 ff_filter "$i" "$out/bdf/$file_name.bdf"
69 done
70
71 # copy ligature plugins
72 cp -r $src/ligature_plugins $out/ligature_plugins
73
74 popd
75
76 runHook postBuild
77 '';
78
79 };
80
81 };
82
83 packages = forAllSystems (system: {
84 inherit (nixpkgsFor."${system}") scientifica bitsnpicas;
85 });
86
87 defaultPackage = forAllSystems (system: self.packages."${system}".scientifica);
88
89 };
90}