Unexplicably unable to rebuild system

Hi,

this issue may look kinda stupid but i’m really stuck and can’t figure out what’s causing the problem,

I have been able to rebuild my system 2 days ago and now i can’t, I didn’t change anything in my config nor update my flake but still i face the same issue:

error:
       … while calling the 'seq' builtin

         at /nix/store/bjvqq8c79dbi59g7xzcc6lhl0f19m3d7-source/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       … while evaluating a branch condition

         at /nix/store/bjvqq8c79dbi59g7xzcc6lhl0f19m3d7-source/lib/modules.nix:261:9:

          260|       checkUnmatched =
          261|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          262|           let

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

       error: getting status of '/nix/store/58pxrkgrslkzjag6m8yy0hazr3ss3dip-source': No such file or directory

this is the error i get when trying to rebuild, i tried git add -a (even though nothing changed since the last commit but still wanted to try)

I cant have any more infos on the issue so i can’t figure out what’s causing this so if anyone have an idea of the source of this kind of error please let me know

here is my flake.nix:

{
  description = "Sailord's Systems configuration";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
    nur.url = "github:nix-community/NUR";

    nix-colors.url = "github:misterio77/nix-colors";

    home = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    hyprland = {
        url = "github:hyprwm/Hyprland";
        inputs.nixpkgs.follows = "nixpkgs";
      };

    hyprland-contrib = {
        url = "github:hyprwm/contrib";
        inputs.nixpkgs.follows = "nixpkgs";
      };

    agenix = {
      url = "github:ryantm/agenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nixvim = {
      url = "github:nix-community/nixvim";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    arion = {
      url = "github:hercules-ci/arion";
      inputs.nixpkgs.follows = "nixpkgs";
    };


  };

  outputs = inputs:
    with inputs; let
      nixpkgsWithOverlays = with inputs; rec {
        config = {
          allowUnfree = true;
          permittedInsecurePackages = [
            # FIXME:: add any insecure packages you absolutely need here
          ];
        };
        overlays = [
          nur.overlay
          (_final: prev: {
            # this allows us to reference pkgs.stable
            stable = import nixpkgs-stable {
              inherit (prev) system;
              inherit config;
            };
          })
        ];
      };

      configurationDefaults = args: {
        nixpkgs = nixpkgsWithOverlays;
        home-manager.useGlobalPkgs = true;
        home-manager.useUserPackages = true;
        home-manager.backupFileExtension = "hm-backup";
        home-manager.extraSpecialArgs = args;
      };

      argDefaults = {
        inherit inputs self;
        channels = {
          inherit nixpkgs nixpkgs-stable;
        };
      };

      mkNixosConfiguration = {
        system ? "x86_64-linux",
        hostname,
        user,
        email ? "",
        args ? {},
        modules,
      }: let
        specialArgs = argDefaults // {inherit hostname user nixvim;} // args;
      in
        nixpkgs.lib.nixosSystem {
          inherit system specialArgs;
          modules =
            [
              (configurationDefaults specialArgs)

              home.nixosModules.home-manager
            ]
            ++ modules;
        };

    in {
      nixosConfigurations = {
        atlas = mkNixosConfiguration {
          hostname = "atlas";
          args = { inherit nix-colors; };
          modules = [
            ./hosts/atlas
            nixvim.nixosModules.nixvim
          ];
        };

        zephyr = mkNixosConfiguration {
          modules = [
            agenix.nixosModules.default
            ./hosts/zephyr
          ];
        };
      };
    };
}

and here is the link of the complete config for those who might want to help me investigate: mathis guilbaud / dotfiles · GitLab

Thanks all :slight_smile:

Are you missing a curly brace at the very bottom?

I don’t think so it’s an indentation problem but no curly braces are missing

Is your nix store corrupted? If not, you could attempt to narrow it down by commenting out modules and trying nixos-rebuild build to identify at least the broken module. Errors in the NixOS module system can be a bit of a pain to untangle, sadly.

it could be my nix store, what can i do in that case ?
I’ll try commenting modules but yeah it is a pain :sweat_smile:

You can verify and repair it.

1 Like

yeah that was it thank you so much, I didn’t know it was possible to repair the store