3

When trying to build suckless/surf and suckless/st from source on NixOs, make cannot find X11 header files, e.g. X11/X.h and X11/Xatom.h. I do have Xlib installed. I also vaguely remember nixos put libraries in an interesting place, and I have seen people suggesting putting some paths to C_INCLUDE variable. Feels like I'm almost there, what's missing?

Update: adding /home/username/.nix-profile/include solved the problem for X.h and Xatom.h, but now it's complaining about X11/extensions/render.h I installed libXrender but it doesn't show up. Where do I find it?

TPS
  • 2,481
rem
  • 185
  • Did you ever find out where to find X11/extensions/render.h? I'm having the same issue---I'm trying to install the haskell X11-xft package, which depends in libXrender, which in turn depends on X11/extensions/render.h.

    EDIT: I realized that it comes from xorg.renderproto.

    – sid-kap Oct 26 '16 at 23:12

1 Answers1

4

surf and st are already packaged (here and here) in nixpkgs

one of the things i love nix is a possibility to override any step in build process, which also means you can change source of the code (eg: src attribute).

just for an example lets say you cloned surf into /path/to/surf. a default.nix file which would override src, but used all the other build steps would be:

{ pkgs ? import <nixpkgs> {}
}:

pkgs.surf.overrideDerivation (old: {
  src = /path/to/surf;
})

above you would build using nix-build default.nix

another way which you can also use is to use nix-shell. nix-shell is a tool that would drop you into nix environment, not running nix build steps, but all dependencies (buildInputs, propagatedBuildInputs) will be available for you. for more about nix-shell you can read here.

to use nix-shell you can do:

% cd /path/where/above/mentioned/default.nix/is
% nix-shell

or you can work on clone of nixpkgs

% cd /path/to/nixpkgs
... here edit file pkgs/applications/misc/st/default.nix
% nix-build -A st    # to build st
% nix-shell -A st    # to enter development environment

i hope above helps.

  • Thanks! The first option appears to work the best, nix-shell doesn't seem to see runtime libraries. To follow up, nix-build builds the project, but how does one install it system-wide? I couldn't find pointers from the manual. – rem Aug 15 '16 at 03:50
  • Figured out -- nix-env -f default.nix -i – rem Aug 15 '16 at 12:35
  • 1
    you can even put it in ~/.nixpkgs/config.nix and then use nix-env -i surf. or if you are on NixOS then you can add overrides in nixpkgs.config.packageOverrides. – Rok Garbas Aug 16 '16 at 10:18