Compare commits
8 Commits
ea9d993324
...
alternate-
Author | SHA1 | Date | |
---|---|---|---|
8626e1e2f1 | |||
6a98c96f7a | |||
a8a62dde7f | |||
dbba1430b0 | |||
9c53e5c3df | |||
3ba0bdc364 | |||
21592dc57d | |||
16cf16e2c4 |
61
README.md
61
README.md
@@ -1,3 +1,62 @@
|
||||
# WIP SMC fonts flake
|
||||
|
||||
This is a WIP Flake that can install SMCs fonts.
|
||||
This is a WIP Flake that can install SMCs fonts. Currently, the following are supported.
|
||||
|
||||
1. Anjali Old Lipi
|
||||
2. Chilanka
|
||||
3. Manjari
|
||||
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.
|
||||
|
||||
## Using with a flakes+home-manager based nixOS setup
|
||||
|
||||
In the inputs section
|
||||
|
||||
```
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
# Other flakes/modules/inputs
|
||||
|
||||
smcFonts.url = "gitlab:smc/smc-fonts-flake/trunk";
|
||||
smcFonts.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
```
|
||||
|
||||
In the outputs section of the flake:
|
||||
|
||||
```
|
||||
# Note the smcFonts being passed as an argument
|
||||
outputs = { self, nixpkgs, smcFonts, <other inputs> }@inputs:
|
||||
let platforms = [ "x86_64-linux" ];
|
||||
in {
|
||||
|
||||
nixosConfigurations = {
|
||||
hex = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; }; # <-- The inputs are being passed down to the modules
|
||||
modules = [
|
||||
(import ./hosts/default.nix)
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Lastly, in `default.nix`
|
||||
|
||||
```
|
||||
{ config, lib, pkgs, modulesPath, inputs, ... }: # <-- "inputs" is an argument
|
||||
let
|
||||
smc-fonts = inputs.smcFonts.packages."${pkgs.system}".default; # <-- by default, it will install all fonts
|
||||
in
|
||||
{
|
||||
|
||||
home-manager.users.<username> = { pkgs, ...}: {
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# list of home manager packages
|
||||
smc-fonts # what we defined above.
|
||||
```
|
||||
|
@@ -11,7 +11,11 @@ pkgs.stdenv.mkDerivation {
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
install -Dm444 -t $out/share/fonts/truetype $src/*.ttf
|
||||
runHook preInstall
|
||||
|
||||
install -D -m444 -t $out/share/fonts/truetype $src/*.ttf
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
|
@@ -11,7 +11,11 @@ pkgs.stdenv.mkDerivation {
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
install -Dm444 -t $out/share/fonts/truetype $src/*.ttf
|
||||
runHook preInstall
|
||||
|
||||
install -D -m444 -t $out/share/fonts/truetype $src/*.ttf
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
|
82
default.nix
82
default.nix
@@ -1,7 +1,77 @@
|
||||
{ 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 ? [ ] }:
|
||||
|
||||
{
|
||||
manjari = pkgs.callPackage ./manjari { };
|
||||
anjali-old-lipi = pkgs.callPackage ./anjali-old-lipi { };
|
||||
chilanka = pkgs.callPackage ./chilanka { };
|
||||
}
|
||||
let
|
||||
# both of these files are generated via ./update.sh
|
||||
version = "version-20241013";
|
||||
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 {
|
||||
# name = "namezzxs"
|
||||
# url = "";
|
||||
# sha256 = "sha256-abc123...";
|
||||
# })
|
||||
# (fetchurl {
|
||||
# name = "namezzxy"
|
||||
# url = "";
|
||||
# sha256 = "sha256-def456...";
|
||||
# })
|
||||
# ]
|
||||
generateUrls = fontAttrs: fontName:
|
||||
builtins.map (variant:
|
||||
let sha = fontAttrs.${variant};
|
||||
in fetchzip {
|
||||
name = "${fontName}-${variant}";
|
||||
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/SMCFonts \; -exec mv {} $out/share/fonts/opentype/SMCFonts \;
|
||||
find -name \*.ttf -exec mkdir -p $out/share/fonts/truetype/SMCFonts \; -exec mv {} $out/share/fonts/truetype/SMCFonts \;
|
||||
'';
|
||||
|
||||
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 ];
|
||||
};
|
||||
})
|
||||
|
6
flake.lock
generated
6
flake.lock
generated
@@ -20,11 +20,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1721924956,
|
||||
"narHash": "sha256-Sb1jlyRO+N8jBXEX9Pg9Z1Qb8Bw9QyOgLDNMEpmjZ2M=",
|
||||
"lastModified": 1728492678,
|
||||
"narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5ad6a14c6bf098e98800b091668718c336effc95",
|
||||
"rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
30
flake.nix
30
flake.nix
@@ -1,5 +1,5 @@
|
||||
{
|
||||
description = "A very basic flake";
|
||||
description = "A flake that installs SMC fonts. It follows unstable.";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
@@ -10,23 +10,21 @@
|
||||
with inputs;
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
font-smc-manjari = pkgs.callPackage ./manjari/default.nix { };
|
||||
font-smc-anjali-old-lipi =
|
||||
pkgs.callPackage ./anjali-old-lipi/default.nix { };
|
||||
font-smc-chilanka = pkgs.callPackage ./chilanka/default.nix { };
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
fonts-smc = pkgs.callPackage ./default.nix { };
|
||||
# font-smc-manjari = pkgs.callPackage ./manjari/default.nix { };
|
||||
# font-smc-anjali-old-lipi =
|
||||
# pkgs.callPackage ./anjali-old-lipi/default.nix { };
|
||||
# font-smc-chilanka = pkgs.callPackage ./chilanka/default.nix { };
|
||||
# font-smc-gayathri = pkgs.callPackage ./gayathri/default.nix { };
|
||||
in rec {
|
||||
packages = {
|
||||
smc-anjali-old-lipi = font-smc-anjali-old-lipi;
|
||||
smc-manjari = font-smc-manjari;
|
||||
smc-chilanka = font-smc-chilanka;
|
||||
|
||||
all = pkgs.symlinkJoin {
|
||||
name = "all";
|
||||
paths =
|
||||
[ font-smc-anjali-old-lipi font-smc-chilanka font-smc-manjari ];
|
||||
};
|
||||
default = packages.all;
|
||||
smc-fonts = fonts-smc;
|
||||
# smc-anjali-old-lipi = font-smc-anjali-old-lipi;
|
||||
# smc-manjari = font-smc-manjari;
|
||||
# smc-chilanka = font-smc-chilanka;
|
||||
# smc-gayathri = font-smc-gayathri;
|
||||
default = fonts-smc;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
28
gayathri/default.nix
Normal file
28
gayathri/default.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
version = "1.300 ";
|
||||
pname = "gayathri";
|
||||
|
||||
src = pkgs.fetchzip {
|
||||
url = "https://smc.org.in/downloads/fonts/gayathri/gayathri.zip";
|
||||
hash = "sha256-p9KZi31Na4hfUuDsKj4OXjc9s6J/8xMeuszlL5oVauQ=";
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -D -m444 -t $out/share/fonts/opentype $src/*.otf
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
homepage = "https://smc.org.in/fonts/gayathri";
|
||||
description = "Chilanka Malayalam Typeface";
|
||||
license = licenses.ofl;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ aashiks ];
|
||||
};
|
||||
}
|
@@ -11,7 +11,11 @@ pkgs.stdenv.mkDerivation {
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
install -Dm444 -t $out/share/fonts/opentype $src/*.otf
|
||||
runHook preInstall
|
||||
|
||||
install -D -m444 -t $out/share/fonts/opentype $src/*.otf
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
|
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=";
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user