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

nix-info: init #30397

Merged
merged 2 commits into from Oct 17, 2017
Merged

nix-info: init #30397

merged 2 commits into from Oct 17, 2017

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Oct 13, 2017

Motivation for this change

Create a one-liner output to help diagnose systems on IRC:

grahamc@Morbo> ./result/bin/nix-help
system: "x86_64-linux", multi-user? yes, version: nix-env (Nix) 1.11.15, channels(root): "nixos-17.09.1547.2231575a7d", channels(grahamc): "fizzbuzz-17.03.1775.56da88a298", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@LnL7
Copy link
Member

LnL7 commented Oct 13, 2017

$ nix-help
system: "x86_64-darwin", multi-user? yes, version: nix-env (Nix) 1.12pre5619_346aeee1, channels(root): "", channels(lnl): "latest", nixpkgs: ~/.nix-defexpr/nixpkgs

}

desc_multi_user() {
if test -e /nix/var/nix/daemon-socket; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realised that this will probably always exist on darwin, unless nix was installed before the multi-user installer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel okay with this, but if there is a good fix / improvement I'd be happy to do that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about also checking test $NIX_REMOTE = daemon and printing unknown instead if the results are inconsistent

@grahamc grahamc force-pushed the nix-help branch 2 times, most recently from dbfdd67 to 8dc07e5 Compare October 13, 2017 21:53
@grahamc
Copy link
Member Author

grahamc commented Oct 13, 2017

grahamc@Morbo> ./result/bin/nix-help -m

  • system: "x86_64-linux"
  • multi-user?: daemon
  • version: nix-env (Nix) 1.11.15
  • channels(root): "nixos-17.09.1547.2231575a7d"
  • channels(grahamc): "fizzbuzz-17.03.1775.56da88a298"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

@Mic92
Copy link
Member

Mic92 commented Oct 13, 2017

How about naming it nix-info?

@grahamc
Copy link
Member Author

grahamc commented Oct 13, 2017

done, @Mic92

@grahamc grahamc changed the title nix-help: init nix-info: init Oct 13, 2017
@grahamc
Copy link
Member Author

grahamc commented Oct 13, 2017

I included nix-info in to the default closure per @LnL7's suggestion.

@grahamc grahamc force-pushed the nix-help branch 2 times, most recently from e0757d5 to cc2f1d6 Compare October 14, 2017 00:12
@grahamc
Copy link
Member Author

grahamc commented Oct 14, 2017

Two outputs:

$ ./result/bin/nix-info

system: "x86_64-linux", multi-user?: daemon, version: nix-env (Nix) 1.11.15, channels(root): "nixos-17.09.1547.2231575a7d", channels(grahamc): "fizzbuzz-17.03.1775.56da88a298", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

$ ./result/bin/nix-info -m

  • system: "x86_64-linux"
  • uname -srvm: Linux 4.9.53 #1-NixOS SMP Thu Oct 5 07:44:17 UTC 2017 x86_64
  • multi-user?: daemon
  • sandbox: build-use-sandbox = true
  • version: nix-env (Nix) 1.11.15
  • channels(root): "nixos-17.09.1547.2231575a7d"
  • channels(grahamc): "fizzbuzz-17.03.1775.56da88a298"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@zimbatm
Copy link
Member

zimbatm commented Oct 14, 2017

It might be useful to include source /etc/os-release && echo $VERSION to the report. Most linux systems are migrating to this new standard: https://www.freedesktop.org/software/systemd/man/os-release.html

@grahamc
Copy link
Member Author

grahamc commented Oct 14, 2017 via email

@grahamc grahamc force-pushed the nix-help branch 2 times, most recently from 7ca954d to 74f39be Compare October 14, 2017 21:48
@grahamc
Copy link
Member Author

grahamc commented Oct 15, 2017

Updated: it now performs conclusive sandboxing and multi-user testing by running nix builds.

Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Works for me on NixOS.

@zimbatm zimbatm added the 9.needs: port to stable A PR needs a backport to the stable release. label Oct 16, 2017
@zimbatm
Copy link
Member

zimbatm commented Oct 16, 2017

If this change was back-ported to 17.09 (and 17.03?) then it can be used for issues reporting more reliably.

@edolstra
Copy link
Member

Wouldn't it be better to include something like this in Nix itself?

@Mic92
Copy link
Member

Mic92 commented Oct 16, 2017

On the long term maybe, but it could take a while until we have a new nix version.

@edolstra
Copy link
Member

I don't think adding a separate command is the way to go, because then we would need to tell people to install a separate package just to get some trivial bits of info that Nix can easily provide. (E.g. why run nix-build several times when you can just print the value of settings.sandboxMode.)

IMHO it would be better to expand the output of nix-store --version -v.

@grahamc
Copy link
Member Author

grahamc commented Oct 16, 2017

@edolstra the reason I didn't propose this in core Nix is the lifecycle. If we determine there is something useless in this command, or more important information, it takes just a couple days to update it. I would prefer it be in core Nix, but I think it would be helpful to mature the tool for a bit. That said, I agree: making the nix tool better at describing itself is a good idea, and we could use that information to remove some of the sillier things this tool does to work.

@zimbatm
Copy link
Member

zimbatm commented Oct 16, 2017

I thought that it was obvious that it would be integrated into nix in the long run. Nixpkgs is much more amenable to change and experiment by the community. Once the command has stabilized it will be easy enough to implement an optimized version inside of nix directly.

@grahamc grahamc merged commit ab8b14c into NixOS:master Oct 17, 2017
@grahamc grahamc deleted the nix-help branch October 17, 2017 01:37
@grahamc
Copy link
Member Author

grahamc commented Oct 20, 2017

I'll send a PR updating the issue template soon.

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

Successfully merging this pull request may close these issues.

None yet

7 participants