That’s how you would create a completely new option. You’d also have to make mkOption
available from nixpkgs’ lib to do this.
But this option already exists: Redirecting…
Just set it:
programs.fish.interactiveShellIinit = ''
fnm env --use-on-cd | source
'';