about summary refs log tree commit diff
path: root/pkgs/data/fonts/iosevka/bin.nix
blob: baf96a2a795b0302e382621c762aef0079da5491 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ stdenv
, lib
, fetchurl
, iosevka
, unzip
, variant ? ""
}:

let
  name =
    if lib.hasPrefix "SGr-" variant then variant
    else "Iosevka" + variant;

  variantHashes = import ./variants.nix;
  validVariants = map (lib.removePrefix "Iosevka")
    (builtins.attrNames (builtins.removeAttrs variantHashes [ "Iosevka" ]));
in
stdenv.mkDerivation rec {
  pname = "${name}-bin";
  version = "30.3.2";

  src = fetchurl {
    url = "https://github.com/be5invis/Iosevka/releases/download/v${version}/PkgTTC-${name}-${version}.zip";
    sha256 = variantHashes.${name} or (throw ''
      No such variant "${variant}" for package iosevka-bin.
      Valid variants are: ${lib.concatStringsSep ", " validVariants}.
    '');
  };

  nativeBuildInputs = [ unzip ];

  dontInstall = true;

  unpackPhase = ''
    mkdir -p $out/share/fonts
    unzip -d $out/share/fonts/truetype $src
  '';

  meta = {
    inherit (iosevka.meta) homepage downloadPage description license platforms;
    maintainers = with lib.maintainers; [
      montchr
    ];
  };

  passthru.updateScript = ./update-bin.sh;
}