How to convert functions and “code” from zsh files in nix language?

Hey folks, I’m relatively new to Nix and on a long process to unload most of my dotfiles to nix configurations.

For context my configuration is here.

Aliases were easy to convert, but my question is if there’s a way to use the nix language to create shell functions. Or how people do to declare conditionals/code. I’m wondering if there’s some sort of “eval”, but then not sure if it has any benefit from my current approach of copying the files instead.

Unless you write your own nix to zsh transpiler, writing zsh functions in nix would require creating some sort of DSL for code generation. And just writing it in zsh is still probably the easiest way to do it.