Skip to content

nixos-rebuild switch not working on fresh instance (ami-0e6b1f052101d5b5d) #107

@orthonormalremy

Description

@orthonormalremy

This is a fresh ec2 instance and nixos-rebuild switch which fails out of the box; eventually was able to get something to work (see below).

Any way to have the conventional command work out of the box?

Thank you in advance.

error:

[root@ip-172-31-89-205:~]# nixos-rebuild switch
error:
       _ while evaluating the attribute 'config'
         at /nix/store/9g7vwfbsk7hcp12vrm8a82cnv6y9v8fb-source/lib/modules.nix:360:9:
          359|         options = checked options;
          360|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          361|         _module = checked (config._module);

       _ while calling the 'seq' builtin
         at /nix/store/9g7vwfbsk7hcp12vrm8a82cnv6y9v8fb-source/lib/modules.nix:360:18:
          359|         options = checked options;
          360|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          361|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: could not build a newer version of nixos-rebuild, using current version
building the system configuration...
error:
       _ while evaluating the attribute 'config'
         at /nix/store/9g7vwfbsk7hcp12vrm8a82cnv6y9v8fb-source/lib/modules.nix:360:9:
          359|         options = checked options;
          360|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          361|         _module = checked (config._module);

       _ while calling the 'seq' builtin
         at /nix/store/9g7vwfbsk7hcp12vrm8a82cnv6y9v8fb-source/lib/modules.nix:360:18:
          359|         options = checked options;
          360|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          361|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.toplevel --no-out-link' returned non-zero exit status 1.

[root@ip-172-31-89-205:~]# # attempt 2


[root@ip-172-31-89-205:~]# nixos-rebuild switch -I nixos-config=/etc/nixos/configuration.nix
error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
building the system configuration...
error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.toplevel --include nixos-config=/etc/nixos/configuration.nix --no-out-link' returned non-zero exit status 1.

[root@ip-172-31-89-205:~]# # this one works:

[root@ip-172-31-89-205:~]# NIX_CONFIG="experimental-features = nix-command flakes" nixos-rebuild switch -I nixos-config=/etc/nixos/configuration.nix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions