Skip to content

writeScript: line 2: syntax error near unexpected token `$1', but when running it directly it works fine #214848

Closed
@ghost

Description

Describe the bug

I create a fontforge script using a env shebang and the fontforge command needed, and i get that error, but the script works fine if ran manually.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Use the writer
  2. See it fail

Expected behavior

Well, it should work fine.

Screenshots

Additional context

Here's the code, it's an overlay I use on my home-manager setup. Tab's only used for the script definition, the actual contents use spaces to work around NixOS/nix#2911
emoji-removal = super.writeScript "emoji-removal" ''
#!/usr/bin/env -S ${super.fontforge}/bin/fontforge -lang=ff -script
Open($1)
SetTTFName(0x409,13,"")
Select(0u2600,0u26ff)
DetachAndRemoveGlyphs()
Generate($1)
Select(0u2700,0u27bf)
DetachAndRemoveGlyphs()
Generate($1)
Select(0u10000,0u1fffd)
DetachAndRemoveGlyphs()
Generate($1)
'';

Notify maintainers

Not necessarily maintainers, but the last people that touched the code...
@milahu @hsjobeki

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.8-zen1, NixOS, 23.05 (Stoat), 23.05pre449318.2caf4ef5005`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.2`
 - channels(root): `"nixos"`
 - channels(m911t): `"home-manager"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions