Unable to install NixOS

When I try to run

sudo nixos-install --show-trace

I get a message

[nixos@nixos:~]$ sudo nixos-install --show-trace
building the configuration in /mnt/etc/nixos/configuration.nix...
error: while evaluating the attribute 'config.system.build.toplevel' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:64:5:
while evaluating the attribute 'config' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:236:9:
while evaluating 'mapAttrsRecursiveCond' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:296:36, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:171:28:
while evaluating 'recurse' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:298:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:306:8:
while evaluating the attribute 'matchedOptions' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:487:14:
while evaluating 'flip' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:138:16, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:455:23:
while evaluating 'byName' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:424:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:443:21:
while evaluating 'reverseList' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:393:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:163:33:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:313:37, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:159:25:
while evaluating 'filterModules' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:303:36, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:314:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:307:31, called from undefined position:
while evaluating 'loadModule' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:249:53, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:290:22:
while evaluating 'unifyModuleSyntax' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:318:34, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:255:14:
while evaluating 'applyIfFunction' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:29, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:255:59:
while evaluating 'isFunction' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:364:16, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:68:
syntax error, unexpected invalid token, at /mnt/etc/nixos/configuration.nix:71:3

I think my configuration.nix is not the problem but I am not sure.
I have done a hash check.
I am not that good in Linux so I don’t know what other logs to provide.
Thanks in advance!!!

Welcome. Your configuration.nix is the problem: Nix is telling you that there’s something syntactically incorrect on line 71. If you cant tell what it is, can you post your configuration.nix in full or in part?

2 Likes

Yep, that was the issue. I have uncommented one theing that was supposed to be commented. Now after I have installed it I cannot boot into the system. I boot to the BOIS settings. I think the bootloader. Here is the GitHub repo for my config GitHub - DokStook/nixos

I imagine the lines here aren’t present in what you actually installed? Those shouldn’t work at all, and nix should complain that the syntax is wrong.

For reference, any configuration options need to be set in between the { and }. Think of it as a JSON object, if you’re familiar with that.

As for your boot issue, there’s nothing else obvious from the configuration you shared, though we can’t see the hardware configuration part of it. What exactly do you see when the boot happens? Any error messages?

So I fixed the first error. I don’t have any idea why the second thing is happening. The lines you talked about I have added from DistroTube’s video about the os. I just realised that he is on an older version. And no, I dont see any errors while booting. Straight up boots to BIOS.

Edit: when I get home I will publish the hardware cofiguration.

I suspect you likely didn’t install NixOS, but quit the installer with an error still present - the lines themselves are correct (although they will conflict with systemd-boot, and will therefore give you an error), they just aren’t in the right place.

Shameless plug but I created a tool to simplify the whole install process for people that want a “just works” solution to get up and running with NixOS: GitHub - samuela/nixos-up: The fastest NixOS install there is! 🏎️🏁.

Give it a shot if you like and let me know if anything doesn’t work!

3 Likes

Hello, thanks for your help! I used your script. It installed the system but without any programs. I tried edditing your config to include some programs but no, nothing is installed. While during the initial install I saw package names like LibreOffice. Also the wifi isn’t working. I uncommented the networking.wierless.enabe = true and rebuilt the system

Yes, the idea is that your can configure the system with whatever programs you like once NixOS is installed.

I got that idea but after I wrote the comment. What could cause the wifi issue?

That’s a good question. IIRC wireless services are turned off by default but I don’t remember the reference for that. The place to start is probably the installation section of the manual for those sorts of things.

What exactly do you mean by “not working”? As in the installation manual, you’ll need to also either set up networkmanager or configure wpa_supplicant.

Which of those do you use, if any? The easiest for someone with no experience, but at least GNOME set up is probably networkmanager, with a config like the one documented here.

If you’re setting up a non-graphical system, follow this section a bit further down instead.

It’s probably worth looking at the post-install section from that page in general at this point :slight_smile:

Hah, ok I missed that part of the manual😅. I thought it was going to be an option in the bottom right like it was on my previous os. Now probably the last issue I will have with the setup: Nvidia Drivers… as the manual suggests I add the needed lines to my configuration (and also updated my github repo). I don’t think I will need your help for this. I will try to do itt by myself. If any help is needed I will either start a new thread or reply here again. Thanks again for your and @samuela help

No problem @DokStook, happy to help! For NVIDIA drivers I do the following in my /etc/nixos/configuration.nix:

  # NVIDIA drivers, etc.
  nixpkgs.config.allowUnfree = true;
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.opengl.enable = true;

See also Nvidia - NixOS Wiki for way, way more info!

I already did that. After rebuilding and rebooting I get to tty and it stays like that forever. In the previous os I was using (ArcoLinux) I had the same issue and fixed it by changing the display manager from sddm to lightdm. I tried the same thing here too and it didn’t work :frowning:

Ah yeah that sounds like a display manager issue. I’m running on a server so I don’t have those particular issues. I would suggest opening a separate discourse thread/github issue for that. Def seems like the kind of thing someone more knowledgeable than I has probably encountered before!