Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: attribute ‘bsd3’ missing #4

Closed
mantkiew opened this issue Mar 9, 2017 · 10 comments
Closed

error: attribute ‘bsd3’ missing #4

mantkiew opened this issue Mar 9, 2017 · 10 comments

Comments

@mantkiew
Copy link

mantkiew commented Mar 9, 2017

On Ubuntu 16.04.2 amd64

I can do build successfully with nix-build but nix-shell throws this error:

$ nix-shell --show-trace
error: while evaluating the attribute ‘env.haskell’ at /home/.../example-nix/modules/pkgs-make/default.nix:54:25:
while evaluating the attribute ‘env’ at /home/.../example-nix/modules/pkgs-make/haskell.nix:133:12:
while evaluating ‘makeOverridable’ at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/lib/customisation.nix:54:24, called from /home/.../example-nix/modules/pkgs-make/haskell.nix:112:10:
while evaluating anonymous function at /home/.../example-nix/modules/pkgs-make/haskell.nix:39:14, called from /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/lib/customisation.nix:56:12:
while evaluating ‘makeOverridable’ at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/lib/customisation.nix:54:24, called from /home/.../example-nix/modules/pkgs-make/haskell.nix:39:20:
while evaluating anonymous function at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/development/haskell-modules/generic-builder.nix:5:1, called from /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/lib/customisation.nix:56:12:
while evaluating ‘mkDerivation’ at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/stdenv/generic/default.nix:111:5, called from /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/development/haskell-modules/generic-builder.nix:170:1:
while evaluating ‘checkValidity’ at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/stdenv/generic/default.nix:211:23, called from /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/stdenv/generic/default.nix:238:22:
while evaluating ‘hasDeniedUnfreeLicense’ at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/stdenv/generic/default.nix:72:28, called from /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/stdenv/generic/default.nix:212:12:
while evaluating ‘isUnfree’ at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/stdenv/generic/default.nix:57:14, called from /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/stdenv/generic/default.nix:75:5:
while evaluating ‘toList’ at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/lib/lists.nix:198:12, called from /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/stdenv/generic/default.nix:75:15:
while evaluating the attribute ‘meta.license’ at /nix/store/977dc6s2lxnysa3gbvnjm1s4sk7i5gah-nixpkgs-fa03b8279fa9b544c29c97eaa5263163b6716046-src/pkgs/development/haskell-modules/generic-builder.nix:327:19:
while evaluating the attribute ‘nix.licenses.bsd3’ at /home/.../example-nix/modules/pkgs-make/lib/default.nix:10:9:
attribute ‘bsd3’ missing, at /home/.../example-nix/modules/pkgs-make/haskell.nix:116:23
@shajra
Copy link
Owner

shajra commented Mar 9, 2017

I remember having that problem in an older version of this project (when I bumped from one nixpkgs version to a later one).

I just did a fresh checkout of this "example-nix" project on a different machine, and all the commands I tried seemed to work as I'd expect:

  • nix-buid
  • nix-shell
  • bin/build_native-package_docker
  • bin/build_docker-package_docker
  • bin/licenses

@mantkiew can you validate that you have the latest version of this project and try again if you don't?

I moved fast, and since it was just me on this project, I didn't make the most atomic commits with very verbose commit messages. I'll likely change that habit now that more eyes are on the project.

@mantkiew
Copy link
Author

mantkiew commented Mar 10, 2017

Yes, I am up to date with master. Cloned the repo on March 8th, pulled again on March 9th to check.

I am on Ubuntu 16.04.2 and installed Nix on March 08.

When I try bin/licenses, it sort of works but then at the end I see:

ESC[1;39m{
  ESC[0mESC[34;1m"example-app-compact"ESC[0mESC[1;39m: ESC[0mESC[1;39m[
    ESC[1;39m{
      ESC[0mESC[34;1m"path"ESC[0mESC[1;39m: ESC[0mESC[0;32m"/nix/store/57y7qsvda3xxll9i5lkyq8d9rnfscjpc-example-compact"ESC[0mESC[1;39m
    ESC[1;39m}ESC[0mESC[1;39m,
    ESC[1;39m{
      ESC[0mESC[34;1m"path"ESC[0mESC[1;39m: ESC[0mESC[0;32m"/nix/store/6hisvjm8z30bx8isijpz81pjimkm4j3g-ekg-assets"ESC[0mESC[1;39m
    ESC[1;39m}ESC[0mESC[1;39m,
.....<lots more of output cut>....

in less.

But doing

nix-build --attr example-app-compact build.nix
nix-build --attr example-extra.licenses build.nix

works and produces correct /nix/store/rycpypb6zpynblifwkb4q58qgmvpn6s2-license.json.

@shajra
Copy link
Owner

shajra commented Mar 10, 2017

@mantkiew the "ESC[" stuff is because I was trying to be fancy with jq and cat ANSI-colorized output. A lot of modern terminals support that, but I guess it's not worth putting in if it messes up on people with more minimal terminals.

So that aside, it sounds like everything's working, right? If I take out the "--color-output" flag on the jq call, will that be enough of a fix to close this issue?

@shajra
Copy link
Owner

shajra commented Mar 10, 2017

@mantkiew actually, what terminal are you using? Can you run this?

env | grep TERM

I can probably make the script a touch more intelligent about colorized outputs.

@mantkiew
Copy link
Author

No, the attribute ‘bsd3’ missing problem still occurs.

I have TERM=xterm-color.

@mantkiew
Copy link
Author

I switched to default TERM=xterm-256color but still the same output.

@shajra
Copy link
Owner

shajra commented Mar 10, 2017

I wasn't able to produce your problem with nix-shell on two of my machines... but I am able to reproduce it from a Docker container of the "nixos/nix" image. I'm working on figuring out the problem now. It kind of horrifies me that there's not a reproducible build across machines. So I'm very eager to find out what the problem is.

In the meantime, can you try TERM=ansi bin/licenses and see if that fixes your colorization?

@shajra
Copy link
Owner

shajra commented Mar 10, 2017

@mantkiew I figured out the problem and made a branch to test out the fix called "fix/4". I also threw in an attempt to fix the colorization of the less output.

Let me know whether either fix works or not, and I'll merge or patch more accordingly.

@mantkiew
Copy link
Author

The branch fix/4 works well for nix-shell now. It's amazing - there must have been some name conflict undetected by Nix or what? Is that a bug in Nix?

For the licenses:

$ nix-build --attr example-extra.licenses build.nix 
/nix/store/rycpypb6zpynblifwkb4q58qgmvpn6s2-license.json
$ ./bin/licenses 
ESC[1;39m{
  ESC[0mESC[34;1m"example-app-compact"ESC[0mESC[1;39m: ESC[0mESC[1;39m[
    ESC[1;39m{
      ESC[0mESC[34;1m"path"ESC[0mESC[1;39m: ESC[0mESC[0;32m"/nix/store/57y7qsvda3xxll9i5lkyq8d9rnfscjpc-example-compact"ESC[0mESC[1;39m
    ESC[1;39m}ESC[0mESC[1;39m,

I am using the built-in terminal, terminix, and terminator, and it's the same in each (btw, each of them is setting the TERM in a different way but your script overrides it).

@shajra
Copy link
Owner

shajra commented Mar 12, 2017

@mantkiew it was kind of silly. I had a function that generated a license report assigned to an attribute called "license" and I just thought it would be more clear named "licenses" since it gave you all the licenses for all the dependencies, not just the single license for the project. Anyway, that rename overrode a pre-existing attribute named "licenses" that had all the licenses themselves as values.

I guess if Nix had a row-polymorphic type system, I'd have caught this, because the type of the value assigned to the "licenses" attribute changed from a set to a function. It just didn't break because my setting of "allowUnfree = true" in my ~/.nixpkgs/config.nix precluded the evaluation of this error. You, though, didn't have that setting, so you saw the problem. This is also why I could reproduce the problem in Docker, but not on the two machines I'd configured myself (because I'd copied my config.nix over).

So the lessons I learned are

  • be careful about overriding attributes in Nix with the // operator
  • keep my ~/.nixpkgs/config.nix as empty as possible.

I'm going to merge these changes all into master, because nix-shell not working is pretty bad.

As for your terminal problem. I got terminix and terminator on my computer right now, and everything is working for me. So I think I need to think more about more environment variables. I'll close this issue, and open another issue, just for the colorization of the small script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants