wip: generate src inputs
This commit is contained in:
parent
a8a62dde7f
commit
6a98c96f7a
@ -8,7 +8,7 @@ This is a WIP Flake that can install SMCs fonts. Currently, the following are su
|
|||||||
4. Gayathri
|
4. Gayathri
|
||||||
|
|
||||||
*NOTE* I am not that familiar with nix flakes yet. This repo will see a lot more activity and perhaps significant change in structure in the near future.
|
*NOTE* I am not that familiar with nix flakes yet. This repo will see a lot more activity and perhaps significant change in structure in the near future.
|
||||||
|
|
||||||
## Using with a flakes+home-manager based nixOS setup
|
## Using with a flakes+home-manager based nixOS setup
|
||||||
|
|
||||||
In the inputs section
|
In the inputs section
|
||||||
|
79
default.nix
79
default.nix
@ -1,7 +1,74 @@
|
|||||||
{ pkgs, ... }:
|
{ stdenv, fetchzip, lib
|
||||||
|
# To select only certain fonts, put a list of strings to `fonts`: every key in
|
||||||
|
# ./shas.nix is an optional font
|
||||||
|
, fonts ? [ ] }:
|
||||||
|
|
||||||
{
|
let
|
||||||
manjari = pkgs.callPackage ./manjari { };
|
# both of these files are generated via ./update.sh
|
||||||
anjali-old-lipi = pkgs.callPackage ./anjali-old-lipi { };
|
version = "version-20241013";
|
||||||
chilanka = pkgs.callPackage ./chilanka { };
|
fontsShas = import ./shas.nix;
|
||||||
}
|
knownFonts = builtins.attrNames fontsShas;
|
||||||
|
selectedFonts = if (fonts == [ ]) then
|
||||||
|
knownFonts
|
||||||
|
else
|
||||||
|
let unknown = lib.subtractLists knownFonts fonts;
|
||||||
|
in if (unknown != [ ]) then
|
||||||
|
throw "Unknown font(s): ${lib.concatStringsSep " " unknown}"
|
||||||
|
else
|
||||||
|
fonts;
|
||||||
|
|
||||||
|
# Filter the fonts by selectedFonts list
|
||||||
|
filteredFonts =
|
||||||
|
builtins.filter (fontName: builtins.elem fontName selectedFonts)
|
||||||
|
(builtins.attrNames fontsShas);
|
||||||
|
|
||||||
|
# Function to generate a list of srcs that look like
|
||||||
|
# [
|
||||||
|
# (fetchurl {
|
||||||
|
# url = "";
|
||||||
|
# sha256 = "sha256-abc123...";
|
||||||
|
# })
|
||||||
|
# (fetchurl {
|
||||||
|
# url = "";
|
||||||
|
# sha256 = "sha256-def456...";
|
||||||
|
# })
|
||||||
|
# ]
|
||||||
|
generateUrls = fontAttrs: fontName:
|
||||||
|
builtins.map (variant:
|
||||||
|
let sha = fontAttrs.${variant};
|
||||||
|
in fetchzip {
|
||||||
|
url = "https://smc.org.in/downloads/fonts/${fontName}/${variant}.zip";
|
||||||
|
sha256 = sha;
|
||||||
|
stripRoot = false;
|
||||||
|
}) (builtins.attrNames fontAttrs);
|
||||||
|
|
||||||
|
# Generate srcs for the filtered fonts
|
||||||
|
srcs = builtins.concatLists
|
||||||
|
(builtins.map (fontName: generateUrls fontsShas.${fontName} fontName)
|
||||||
|
filteredFonts);
|
||||||
|
|
||||||
|
in stdenv.mkDerivation (finalAttrs: {
|
||||||
|
inherit version;
|
||||||
|
inherit srcs;
|
||||||
|
pname = "smc-fonts";
|
||||||
|
# sourceRoot = ".";
|
||||||
|
buildPhase = ''
|
||||||
|
echo "selected fonts are ${toString selectedFonts}"
|
||||||
|
ls *.otf *.ttf
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
find -name \*.otf -exec mkdir -p $out/share/fonts/opentype/ \; -exec mv {} $out/share/fonts/opentype/ \;
|
||||||
|
find -name \*.ttf -exec mkdir -p $out/share/fonts/truetype/ \; -exec mv {} $out/share/fonts/truetype/ \;
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "SMC typefaces";
|
||||||
|
longDescription = ''
|
||||||
|
Swathanthra Malayalam Computing.
|
||||||
|
'';
|
||||||
|
homepage = "https://smc.org.in/";
|
||||||
|
license = licenses.ofl;
|
||||||
|
platforms = platforms.all;
|
||||||
|
maintainers = with maintainers; [ aashiks ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721924956,
|
"lastModified": 1728492678,
|
||||||
"narHash": "sha256-Sb1jlyRO+N8jBXEX9Pg9Z1Qb8Bw9QyOgLDNMEpmjZ2M=",
|
"narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5ad6a14c6bf098e98800b091668718c336effc95",
|
"rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
32
flake.nix
32
flake.nix
@ -11,28 +11,20 @@
|
|||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
font-smc-manjari = pkgs.callPackage ./manjari/default.nix { };
|
fonts-smc = pkgs.callPackage ./default.nix { };
|
||||||
font-smc-anjali-old-lipi =
|
# font-smc-manjari = pkgs.callPackage ./manjari/default.nix { };
|
||||||
pkgs.callPackage ./anjali-old-lipi/default.nix { };
|
# font-smc-anjali-old-lipi =
|
||||||
font-smc-chilanka = pkgs.callPackage ./chilanka/default.nix { };
|
# pkgs.callPackage ./anjali-old-lipi/default.nix { };
|
||||||
font-smc-gayathri = pkgs.callPackage ./gayathri/default.nix { };
|
# font-smc-chilanka = pkgs.callPackage ./chilanka/default.nix { };
|
||||||
|
# font-smc-gayathri = pkgs.callPackage ./gayathri/default.nix { };
|
||||||
in rec {
|
in rec {
|
||||||
packages = {
|
packages = {
|
||||||
smc-anjali-old-lipi = font-smc-anjali-old-lipi;
|
smc-fonts = fonts-smc;
|
||||||
smc-manjari = font-smc-manjari;
|
# smc-anjali-old-lipi = font-smc-anjali-old-lipi;
|
||||||
smc-chilanka = font-smc-chilanka;
|
# smc-manjari = font-smc-manjari;
|
||||||
smc-gayathri = font-smc-gayathri;
|
# smc-chilanka = font-smc-chilanka;
|
||||||
|
# smc-gayathri = font-smc-gayathri;
|
||||||
all = pkgs.symlinkJoin {
|
default = fonts-smc;
|
||||||
name = "all";
|
|
||||||
paths = [
|
|
||||||
font-smc-anjali-old-lipi
|
|
||||||
font-smc-chilanka
|
|
||||||
font-smc-manjari
|
|
||||||
font-smc-gayathri
|
|
||||||
];
|
|
||||||
};
|
|
||||||
default = packages.all;
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
52
shas.nix
Normal file
52
shas.nix
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
# Font name , variant and sha
|
||||||
|
"anjalioldlipi" = {
|
||||||
|
"anjalioldlipi" = "sha256-c3ScpdN2h39Q6GLFL97pBBGrsillcMXmhlGilOAdF1w=";
|
||||||
|
};
|
||||||
|
"chilanka" = {
|
||||||
|
"chilanka" = "sha256-z+pRvm/8alA3TbUBuR4oDD/kpvuXJTqOBlzXEKBZvnE=";
|
||||||
|
};
|
||||||
|
"dyuthi" = {
|
||||||
|
"dyuthi" = "sha256-H+2ccvHmlZjtH8KfWBSQKPtMkY/NsydHqFNaTzLS4S8=";
|
||||||
|
};
|
||||||
|
"gayathri" = {
|
||||||
|
"gayathri" = "sha256-p9KZi31Na4hfUuDsKj4OXjc9s6J/8xMeuszlL5oVauQ=";
|
||||||
|
};
|
||||||
|
"karumbi" = {
|
||||||
|
"karumbi" = "sha256-aeKH7CWbJNtkgv1PsaWWxyBZor+UO9q9Cctpc/qnEQU=";
|
||||||
|
};
|
||||||
|
"keraleeyam" = {
|
||||||
|
"keraleeyam" = "sha256-UEhDtBaWof/2C36IapGhtYgdeQInUn+A/UAJIF7+RuA=";
|
||||||
|
};
|
||||||
|
"malini" = {
|
||||||
|
"Malini" = "sha256-LvXf1zAlLvZhn2/peRVjOPjQwG46mMP8Dxuvs4fmK1s=";
|
||||||
|
};
|
||||||
|
"manjari" = {
|
||||||
|
"manjari" = "sha256-Sq/7UOBO54c3id6FMZeOmnZTRceEkMAAN8W+C7v7Mtw=";
|
||||||
|
};
|
||||||
|
"meera" = {
|
||||||
|
"meera" = "sha256-yaqA2gYKc4OJ9YxmvQPUZ3qZFyKj0YciMaUoY1SST4I=";
|
||||||
|
};
|
||||||
|
"nupuram" = {
|
||||||
|
"Nupuram-Arrows-Color" =
|
||||||
|
"sha256-oFsUCu3mDuHok7BXPnb1VdKmqP7DTw6TXKv6iXDknzA=";
|
||||||
|
"Nupuram-Calligraphy" =
|
||||||
|
"sha256-R2fPKe5PZqWu4ftV3/iVZptBhq9rku7EcXQGzGgylns=";
|
||||||
|
"Nupuram-Color" = "sha256-JwanvoGtI3BrG/DxGreo+gVZNGPjLiQA31nheNcuZWw=";
|
||||||
|
"Nupuram-Dots" = "sha256-5V09G4PkDnHHd/oIRe3kHX6BOQ5HuVVcFSlae32bdVs=";
|
||||||
|
};
|
||||||
|
"rachana" = {
|
||||||
|
"rachana" = "sha256-csfMs4B6BD+yap/AaWpm4kQDsR/WNMrym6szM5iZNJo=";
|
||||||
|
};
|
||||||
|
"raghumalayalamsans" = {
|
||||||
|
"raghumalayalamsans" =
|
||||||
|
"sha256-rSM77MiFqRzs67mme8xkJZkw13esB9eG13j8OzytCaA=";
|
||||||
|
};
|
||||||
|
"suruma" = {
|
||||||
|
"suruma" = "sha256-x4ybBr5oCwD5Stu8rRGndOYRzaV6ikE+VnLJ/src+1U=";
|
||||||
|
};
|
||||||
|
"uroob" = {
|
||||||
|
"uroob" = "sha256-IJcKD3cDRMA7G7foKtXtJxOrv6OeOujkq9+uGo+R/dY=";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user