Talk: Nix-writers

From NixOS Wiki
Revision as of 22:30, 30 December 2019 by MrVanDalo (talk | contribs) (problem with writeC)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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