nix-community / nix-on-droid

Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli]
https://nix-on-droid.unboiled.info
MIT License
1.16k stars 65 forks source link

fix(terminal.nix): quote font paths #229

Closed reo101 closed 1 year ago

reo101 commented 1 year ago

Problem:

Currently, if one wants to use a font, whose path contains spaces, for instance a nerdfont:

{
  terminal.font =
    let
      firacode = pkgs.nerdfonts.override {
        fonts = [ "FiraCode" ];
      };
      fontPath = "share/fonts/truetype/NerdFonts/Fira Code Regular Nerd Font Complete Mono.ttf";
    in
      "${firacode}/${fontPath}";
}

nix-on-droid would fail to create a correct symlink because the references to ${fontTarget} aren't quoted which leads to ln treating the space-separated parts of the font name as different arguments.

Quoting man ln/LN(1):

     Given more than two arguments, ln makes links in target_dir to all the named
     source files.  The links made will have the same name as the files being linked
     to.

which isn't the wanted behaviour here.

Solution:

Quote all unquoted references to nix variables in the linkFont script in modules/terminal.nix

Demo:

In a nix-on-droid configuration using my fork github:reo101/nix-on-droid/reo101/font_path_quoting the symbolink link is created correctly:

image