the following used to work on 24.05 but no longer works in 24.11. i have no idea
{ config, pkgs, ... }:
# Does a fetchFromGitHub to DL my fonts from my repo
# https://github.com/tolgaerok/apple-fonts
{
fonts.packages = with pkgs; [
(pkgs.callPackage ./basic-fonts.nix { })
(pkgs.callPackage ./my-fonts.nix { })
];
}
My my-fonts.nix
{ stdenvNoCC, fetchFromGitHub }:
stdenvNoCC.mkDerivation {
pname = "my-fonts";
version = "1.0-stable-29-jun-2024";
src = fetchFromGitHub {
owner = "tolgaerok";
repo = "apple-fonts";
rev = "fd93227bf50a81a025a406952e388348fae707f1"; # Updated commit hash
hash = "sha256-IBnV/+9QITFSLePuQ/XkFjiGfH5tTnQFSMKvUL8t4Ms="; # Updated sha256 hash
};
installPhase = ''
runHook preInstall
mkdir -p $out/share/fonts/{opentype,truetype}
find . -name "*.otf" -type f -exec install -Dm644 {} -t "$out/share/fonts/opentype" \;
find . -name "*.ttf" -type f -exec install -Dm644 {} -t "$out/share/fonts/truetype" \;
runHook postInstall
'';
}
# nix-prefetch-git https://github.com/tolgaerok/apple-fonts
then my basic-fonts.nix is
{ config, pkgs, ... }:
let
installMyFontsScript = ''
mkdir -p $out/share/fonts
wget -q https://github.com/tolgaerok/apple-fonts/archive/refs/heads/main.zip
wget -q https://github.com/tolgaerok/fonts-tolga/raw/main/WPS-FONTS.zip
unzip -o main.zip -d $out/share/fonts
unzip -o WPS-FONTS.zip -d $out/share/fonts
fc-cache -f -v
rm main.zip
rm WPS-FONTS.zip
'';
installMyFonts = pkgs.writeScriptBin "install-my-fonts" installMyFontsScript;
# Create custom varible to house my WPS fonts!
myfontFiles = pkgs.fetchzip {
url = "https://github.com/tolgaerok/fonts-tolga/raw/main/WPS-FONTS.zip";
sha256 = "02imcxnzhmpvhchxmgpfx4af806p7kwx306fspk14s9g1zx7af9z";
stripRoot = false;
};
# myfonts will be the WPS fonts
myfonts = pkgs.stdenv.mkDerivation {
name = "Additional WPS Fonts";
src = myfontFiles;
buildInputs = [ ];
# mkdir will be: /nix/store/xxxxxxx-Additional-WPS-Fonts
buildCommand = ''
mkdir -p $out/share/fonts
cp -R $src $out/share/fonts
'';
};
in
{
imports = [
# ./apple-fonts.nix
];
# Fonts
fonts.packages = with pkgs; [
# nerdfonts
corefonts
fira-code
fira-code-symbols
font-awesome
jetbrains-mono
liberation_ttf
myfonts # my additional WPS fonts
noto-fonts
noto-fonts-cjk
noto-fonts-color-emoji
proggyfonts
];
# The Nix User Repositories (NUR) is a community-driven collection of packages
nixpkgs.config.packageOverrides = pkgs: {
nur = import (builtins.fetchTarball {
url = "https://github.com/nix-community/NUR/archive/master.tar.gz";
}) { inherit pkgs; };
};
environment.systemPackages = with pkgs; [
installMyFonts # Apple && WPS from my repo
];
}
And the error is within the basic-fonts.nix
[tolga@nixos:/etc/nixos]$ sudo nixos-rebuild switch
[sudo] password for tolga:
building Nix...
building the system configuration...
error:
… while calling the 'head' builtin
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1:35741:
… while evaluating the attribute 'value'
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:33591:
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix':
… while evaluating the option `system.systemBuilderArgs':
… while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activatable-system.nix':
… while evaluating the option `system.activationScripts.etc.text':
… while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc-activation.nix':
… while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc.nix':
… while evaluating the option `environment.etc.dbus-1.source':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: A definition for option `fonts.packages."[definition 1-entry 1]"' is not of type `path'. Definition values:
- In `/etc/nixos/config/fonts'
[tolga@nixos:/etc/nixos]$