1

I've cloned the nixpkgs repo. From the top of that repo, I can run nix-build -A waf to build waf, and nix-env -f . -iA waf to make waf part of my user environment. Neither complains -- but afterward I am still unable to call waf:

[jeff@jbb-dell:~/nix/nixpkgs]$ waf
waf: command not found

[jeff@jbb-dell:~/nix/nixpkgs]$ 

Most packages, when I build them using nix-build -A, produce a symlink called result that goes to a folder containing the executable in question. Strangely, though, in waf's case the symlink is to a file, not a folder.

I'm running NixOS. If I add waf to environment.systemPackages in my configuration, upon building I get an error that seems to be a result of the strangeness described in the previous paragraph:

[jeff@jbb-dell:~/nix/jbb-config]$ sudo nixos-rebuild switch
building Nix...
building the system configuration...
these derivations will be built:
  /nix/store/s618gllra3g2vn62c92advg9ks2swkz1-system-path.drv
  /nix/store/gpph3adrgn949mikfvkwld86flshdbvq-unit-polkit.service.drv
  /nix/store/i7xql7889ank54fnhd16zk4z79l1ix88-unit-systemd-fsck-.service.drv
  /nix/store/dv9p4fsrqn1fwdvy9scyc7g9422wvm7c-dbus-1.drv
  /nix/store/y730jf9s9nrzmkf55i01nlwinw5gxpsp-unit-dbus.service.drv
  /nix/store/4wjan71p2di7lscnscdfhp55j49dcymx-system-units.drv
  /nix/store/qrzwrpsz0hh5gzaxic6ww8mnwl03zwil-unit-dbus.service.drv
  /nix/store/lhq0s9s5v3sqvjx6mqlyqj6hf4kv38sf-user-units.drv
  /nix/store/hk5wbmf4dpna3dn0h0q1balj3482l6xd-etc.drv
  /nix/store/yj3lfyv5sbp751xzy9jdw1d06n9gdiin-nixos-system-jbb-dell-19.09.1889.692a8cabbcc.drv
building '/nix/store/s618gllra3g2vn62c92advg9ks2swkz1-system-path.drv'...
The store path /nix/store/f1ylicjswpfx1wbvxapsnwy987qnlxl6-waf-2.0.18 is a file and can't be merged into an environment us ing pkgs.buildEnv! at /nix/store/kncarzyhspzsplkcmmyiqg2cavrwr373-builder.pl line 96.
builder for '/nix/store/s618gllra3g2vn62c92advg9ks2swkz1-system-path.drv' failed with exit code 2
cannot build derivation '/nix/store/yj3lfyv5sbp751xzy9jdw1d06n9gdiin-nixos-system-jbb-dell-19.09.1889.692a8cabbcc.drv': 1 dependencies couldn't be built
error: build of '/nix/store/yj3lfyv5sbp751xzy9jdw1d06n9gdiin-nixos-system-jbb-dell-19.09.1889.692a8cabbcc.drv' failed

[jeff@jbb-dell:~/nix/jbb-config]$ 
Jeffrey Benjamin Brown
  • 3,427
  • 2
  • 28
  • 40

1 Answers1

1

This looks like an implementation error to me. waf, as a top-level Nixpkgs package, should put its binary in $out/bin. I've checked for usages of waf in nixpkgs and it seems to be used inside derivations only via wafHook.

If you only need waf inside a derivation, I recommend going with wafHook, following the example of other packages. If you need to install it in your user profile, ideally you can send a PR to make waf a proper package or you can work around it with a custom derivation.

Robert Hensing
  • 6,708
  • 18
  • 23
  • Do you know where `wafHook` is documented? I can now [build libmonome using wafHook](https://github.com/JeffreyBenjaminBrown/nixos-experiments/blob/c54c7c63d942b95e546076146eab206fd6bac0bb/custom-packages/libmonome/default.nix), but I'm aping other peoples' code without any understanding of how `wafHook` works. – Jeffrey Benjamin Brown Jan 27 '20 at 03:40
  • 1
    I'm afraid the code is the documentation for this one. To understand that code, I think half of it is knowing how waf works and how it's used in this context, and the other half is how Nixpkgs phases work and some advanced bash. If you have a specific question, you could perhaps try git blame and ping those people on irc. – Robert Hensing Jan 27 '20 at 21:59
  • Single binary packages (like waf) do not have to have the full HFS with lib, bin et.c. in the nix store and I've seen this with other packages. In case of `waf` the store path result is not a directory but the executable. If this limits its use with nix-env I was unaware. – mandrake Dec 08 '20 at 07:59