Nix-writers
Nix-writers are a way to write other programming languages inline in nix-code. Basically it's like writeScript/writeScriptBin but for other Languages.
Every writer has a ...Bin variant which can be used inside environment.systemPackages. Most of the writers take an attrributeset where one can add libraries.
Languages
bash
This is basically writeScript but with the shebang to bash already included.
pkgs.writers.writeBash "hello_world" ''
echo 'hello world!'
''
C
pkgs.writers.writeC "hello-world-ncurses" { libraries = [ pkgs.ncurses ]; } ''
#include <ncurses.h>
int main() {
initscr();
printw("Hello World !!!");
refresh(); endwin();
return 0;
}
''
dash
pkgs.writers.writeDash "hello_world" ''
echo 'hello world!'
''