Flake error: packages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild'


I am brand new to NixOS. Please be gentle.

I read the tutorial on the Nix language basics. Since I have a foundational understanding of Python, I understood some of it. I think it’s really cool that functions have no names. They are all lambdas.

I am experimenting with the VBox .ova demo appliance provided on the download page. I got it running and installed some apps by making changes to /etc/nixos/configuration.nix.

I got as far as installing chromium as well as (non-free) google-chrome, libreoffice, python, vim, and a few other apps.

Then I ventured forward exploring flakes to try to install and configure Hyprland. Big mistake. When I invoke $ sudo nixos-rebuild switch, I get this error:

error: flake 'path:/etc/nixos' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild' or 'nixosConfigurations."nixos".config.system.build.nixos-rebuild'

I tried running these commands:

[demo@nixos:/etc/nixos]$ sudo nix-channel --update
unpacking channels...
[demo@nixos:/etc/nixos]$ sudo nix-env -u
[demo@nixos:/etc/nixos]$ sudo nix-channel --update nixpkgs
unpacking channels...

I noodled with the four configuration files inside /etc/nixos/ directory. I made small and large changes, where I added, commented out, re-added different lines one at time and running the above commands after each change which has not yet resolved the error.

I am determined to make this work.

I am sharing my configurations files below with the hope that more experienced users might be able to identify the trivial mistake I am making. Based on the configuration files below, what might you people suggest I try next?

  { config, pkgs, ... }:
  imports = [ <nixpkgs/nixos/modules/installer/virtualbox-demo.nix> ];
  # nix.settings.experimental-features = [ "nix-command" "flakes" ];  

  nixpkgs.config.allowUnfree = true; 
 environment.systemPackages = with pkgs; [
    # ... other packages ...
    # thunar
    # anaconda
    # i3

  services.xserver = {
    enable = true;   
    desktopManager = {
      xterm.enable = false;
      xfce = {
        enable = true;
        noDesktop = true;
        enableXfwm = false;
    displayManager.defaultSession = "xfce";

   programs.hyprland = {
    # Install the packages from nixpkgs
    enable = true;
    # Whether to enable XWayland
    xwayland.enable = true;

    # Optional
    # Whether to enable patching wlroots for better Nvidia support
    # enableNvidiaPatches = true;
  description = "A very basic flake";
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  outputs = { self, nixpkgs }: {
    packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;
    packages.x86_64-linux.default = self.packages.x86_64-linux.hello;
    nixosConfigurations.mySystem = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [ ./configuration.nix ];
{config, pkgs, ... }: 
  home.file."~/.config/hypr/hyprland.conf".text = ''
    decoration {
      shadow_offset = 0 5
      col.shadow = rgba(00000099)

    $mod = SUPER

    bindm = $mod, mouse:272, movewindow
    bindm = $mod, mouse:273, resizewindow
    bindm = $mod ALT, mouse:272, resizewindow
  # ...
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1702312524,
        "narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "a9bf124c46ef298113270b1f84a164865987a91c",
        "type": "github"
      "original": {
        "owner": "nixos",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
  "root": "root",
  "version": 7

You need to call the flake.

Try this guide

When you are set up, then you can put the Hyprland module flake into your master flake

1 Like

nixos-rebuild switch by default looks for a nixosConfigurations key matching the current hostname (which is nixos). But you define nixosConfiguration.mySystem in your flake, not nixosConfiguration.nixos.


  • Change it to nixosConfigurations.nixos in the flake
  • Change the system hostname to mySystem (I’m not sure how case-sensitivity interacts with this)
  • Call nixos-rebuild switch --flake .#mySystem (assuming you are in /etc/nixos).
1 Like

Hi! At first I thought I was getting trolled pretty hard by getting thrown #RTFM at my face up front but after actually reading the doc you shared cover to cover, the author(s) emphasize that the official NixOS docs on the experimental Flake tech are widely believed to be insufficient and inadequate, especially for NixOS newcomers like me. This guide you shared @BriefNCounter was very instructive. You are right that I wasn’t calling the flake correctly.

On my system I resolved to backing up my flake configuration files by renaming them by appending a .backup to the end. Next I ran sudo nixos-rebuild switch. That restored my system to it’s former stay without a packaging or Flake-related traceback. At this point I am not using Flakes.

I appreciate the advice and direction. At this point I don’t really understand any of this. haha. This means this requires some more learning on my part.

After reading some more of the docs (and re-reading the one @BriefNCounter shared), if I have any further questions, I will be sure to return here with a new thread.

Thank you both.

1 Like