Talk:Nix-writers

From NixOS Wiki

start this shell.nix

{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell {
  buildInputs = with pkgs;
    [
      (pkgs.writers.writeC "hello-world-ncurses" {
        libraries = [ pkgs.ncurses ];
      } ''
        #include <ncurses.h>
        int main() {
          initscr();
          printw("Hello World !!!");
          refresh(); endwin();
          return 0;
        }
      '')
    ];
}

I get the error :

/nix/store/3g2pkmc1s9ycjaxaqc5hrzmq05r5ywbi-stdenv-linux/setup: line 1293: find: command not found
Must specify package names on the command line
/build/.attr-0:1:10: fatal error: ncurses.h: No such file or directory
 #include <ncurses.h>
          ^~~~~~~~~~~
compilation terminated.
builder for '/nix/store/n9lj0aw48rwrp8sqc6b3cl2vivd2w59m-hello-world-ncurses.drv' failed with exit code 1
error: build of '/nix/store/n9lj0aw48rwrp8sqc6b3cl2vivd2w59m-hello-world-ncurses.drv' failed