Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nix): add fonts derivation #617

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
craneLib = crane.mkLib pkgs;
in
{
packages.default = pkgs.callPackage ./package.nix { inherit craneLib; };
packages.default = pkgs.callPackage ./nix/package.nix { inherit craneLib; };
packages.fonts = pkgs.callPackage ./nix/fonts.nix {};
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self'.packages;
packages = with pkgs; [
Expand Down
17 changes: 17 additions & 0 deletions nix/fonts.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
lib,
runCommandLocal,
}:
runCommandLocal "uiua-fonts"
{
src = lib.fileset.toSource {
root = ../site;
fileset = lib.fileset.fileFilter ({ hasExt, ... }: hasExt "ttf") ../site;
};
uiua386 = ../src/algorithm/Uiua386.ttf;
}
''
mkdir -p "$out/share/fonts/truetype"
cp "$src"/* "$out/share/fonts/truetype/"
cp "$uiua386" "$out/share/fonts/truetype/Uiua386.ttf"
''
14 changes: 7 additions & 7 deletions package.nix → nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
let
commonArgs = {
src = lib.fileset.toSource {
root = ./.;
root = ../.;
fileset = lib.fileset.unions (
[
(lib.fileset.fromSource (craneLib.cleanCargoSource ./.))
./src/primitive/assets
./src/algorithm/Uiua386.ttf
(lib.fileset.fromSource (craneLib.cleanCargoSource ../.))
../src/primitive/assets
../src/algorithm/Uiua386.ttf
]
++ lib.optionals doCheck [
./site/favicon.ico
./tests
./tests_special
../site/favicon.ico
../tests
../tests_special
]
);
};
Expand Down