Code Monkey home page Code Monkey logo

Comments (10)

shajra avatar shajra commented on July 18, 2024

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.

from nix-example.

mantkiew avatar mantkiew commented on July 18, 2024

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.

from nix-example.

shajra avatar shajra commented on July 18, 2024

@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?

from nix-example.

shajra avatar shajra commented on July 18, 2024

@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.

from nix-example.

mantkiew avatar mantkiew commented on July 18, 2024

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

I have TERM=xterm-color.

from nix-example.

mantkiew avatar mantkiew commented on July 18, 2024

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

from nix-example.

shajra avatar shajra commented on July 18, 2024

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?

from nix-example.

shajra avatar shajra commented on July 18, 2024

@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.

from nix-example.

mantkiew avatar mantkiew commented on July 18, 2024

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).

from nix-example.

shajra avatar shajra commented on July 18, 2024

@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.

from nix-example.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.