Find a profile's configuration.nix and nixpkgs revision

sweethome3d doesn’t start for me on nixos-unstable with a latest kernel:

$ nix-shell -p sweethome3d.application --run sweethome3d
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.eteks.sweethome3d.SweetHome3DBootstrap.main(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
	at javax.media.j3d.GraphicsConfigTemplate3D.isGraphicsConfigSupported(GraphicsConfigTemplate3D.java:348)
	at com.eteks.sweethome3d.j3d.Component3DManager.createGraphicsConfigurationTemplate3D(Unknown Source)
	at com.eteks.sweethome3d.j3d.Component3DManager.<init>(Unknown Source)
	at com.eteks.sweethome3d.j3d.Component3DManager.getInstance(Unknown Source)
	at com.eteks.sweethome3d.SweetHome3D.addComponent3DRenderingErrorObserver(Unknown Source)
	at com.eteks.sweethome3d.SweetHome3D.init(Unknown Source)
	at com.eteks.sweethome3d.SweetHome3D.main(Unknown Source)
	... 5 more
Caused by: com.jogamp.opengl.GLException: Profiles [GL4bc, GL3bc, GL2, GLES1] not available on device null
	at com.jogamp.opengl.GLProfile.get(GLProfile.java:1039)
	at com.jogamp.opengl.GLProfile.get(GLProfile.java:1050)
	at com.jogamp.opengl.GLProfile.getMaxFixedFunc(GLProfile.java:803)
	at javax.media.j3d.JoglPipeline.initialize(JoglPipeline.java:131)
	at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:92)
	at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:858)
	at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:267)
	... 12 more

I have successfully ran this application (last week or so?), but switching to an older version doesn’t appear to help. I suspect it has to do with kernel or X11 updates, but I haven’t bisected my system profiles yet.

The error appears to have to do with graphics drivers and Java versions, so the following might be helpful:

$ nix-shell -p inxi -p xorg.xdpyinfo --run "inxi -G"
Graphics:  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel
           Device-2: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q] driver: nouveau v: kernel
           Display: x11 server: X.Org 1.20.8 driver: nouveau resolution: 3840x2160~60Hz
           OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.0.2

Any ideas how I could further diagnose this issue?

Ah, it does work when I reboot into a previous system profile (my reference: 256), so that gives me something to go on.

Is it possible to find out the configuration.nix and nixpkgs revision that a system profile was built from?

I don’t think so. That’s why I make a copy of nixpkgs and config in the result system profile

1 Like

@raboof have you found a solution to this? I just installed sweethome3d and am running into the same issue.

environment.etc.currentconfig.source = ./.;

Add this line, extremely helpful. I’m surprised though I saw this line almost a full year after starting using NixOS. Wish this were more discussed.

4 Likes

This, as well as nixPath = ["nixpkgs=${pkgs.path}"]; (you may need to manually duplicate the other defaults of nixPath as this does override them). Makes sure every generation sets <nixpkgs> to the version of nixpkgs it was built with. Though you do have to open a new shell for that change to take effect, as it works via the NIX_PATH environment variable.

2 Likes

Just a note it’s possible to get at the defaults with options.nix.nixPath.default and then either filter out the default nixpkgs= entry or prepend to that list.

That looks really useful. I have system.copySystemConfiguration = true; in my config, which will copy just the configuration.nix file. I didn’t realize there was an easy way to copy the whole folder.

IIRC you’ll actually have to re-login, just a new shell is not sufficient. That is why I copy pkgs.path to /run/current-system, where I can swap it without needing to relogin. See https://github.com/timokau/dotfiles/blob/6abb79d70251af1861cb2e4e1dcc68149806300e/nixos/configuration.nix#L64.

The sweethome3d/GLX/mesa part of this thread continued at GLX not recognised after MESA update? :wink:

1 Like

Ah thank you! I was a bit confused by all the answers and just realized they were not addressing this specific issue!

The drawback, I think, is that secrets get into world-readable /nix/store even if they were not meant to be read by nix. Or secrets have to be moved from /etc/nixos elsewhere. Or put them into a single directory which gets filtered with builtins.filterSource or builtins.path.filterSource.

1 Like