Skip to content

Instantly share code, notes, and snippets.

@worldofpeace
Last active September 6, 2020 17:02
Show Gist options
  • Save worldofpeace/d546167739cb41d87f965c9a81e78530 to your computer and use it in GitHub Desktop.
Save worldofpeace/d546167739cb41d87f965c9a81e78530 to your computer and use it in GitHub Desktop.
Nix Expression for FiraCode nerdfont
{ stdenv, fetchzip }:
let
pname = "FiraCode";
version = "v2.0.0";
in
stdenv.mkDerivation rec {
name = "${pname}-nerdfont-${version}";
src = fetchzip {
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/${version}/${pname}.zip";
sha256 = "1bnai3k3hg6sxbb1646ahd82dm2ngraclqhdygxhh7fqqnvc3hdy";
stripRoot = false;
};
buildCommand = ''
install --target $out/share/fonts/opentype -D $src/*.otf
'';
meta = with stdenv.lib; {
description = "Nerdfont version of Fira Code";
homepage = https://github.com/ryanoasis/nerd-fonts;
license = licenses.mit;
};
}
@con-f-use
Copy link

con-f-use commented Jul 20, 2020

I, see. Thanks for taking the time to tell me. If I could get just one more question in, what does the fonts.fonts part exactly do? It seems to be a NixOS module. So what would a non-NixOS user do instead, say if it was a dependency of a custom package.

@con-f-use
Copy link

con-f-use commented Sep 6, 2020

I tried (nerdfonts.override { fonts = [ "FiraCode" ]; }) but that just gives me

error: anonymous function at /nix/store/42s3x72zmvijdjf62ng1091nnhd1ma8g-nixos-20.03.2882.51d115ac89d/nixos/pkgs/data/fonts/nerdfonts/default.nix:1:1 called with unexpected argument 'fonts'

Edit:

Ah I see, it's nerdfonts.override { withFont = "FiraCode"; }), now.

Oh god, that downloads a 2 GB file, rather than the specialized release files for the respective font!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment