rgit icon indicating copy to clipboard operation
rgit copied to clipboard

Nix flake integration causes "error: attribute 'default' missing" to be thrown

Open MTGmonket opened this issue 7 months ago • 1 comments

The content of my flake is as follows:

{
  description = "server flake";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/release-25.05";
    noshell.url = "github:viperML/noshell";
    rgit = {
      url = "github:w4/rgit";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    nixpkgs,
    noshell,
    rgit,
    ...
  }: let
    system = "x86_64-linux";
  in {
    nixosConfigurations."server" = nixpkgs.lib.nixosSystem {
      inherit system;
      modules = [
        rgit.nixosModules.default
        ./services/rgit.nix

        noshell.nixosModules.default
        {programs.noshell.enable = true;}

        ./configuration.nix
      ];
    };
  };
}

The error message thrown upon $ sudo nixos-rebuild switch --flake /etc/nixos |& nom

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

       … while evaluating a branch condition
         at /nix/store/amqap2f6bfc4x6idz0f1j654fls2gm1w-source/lib/modules.nix:295:9:
          294|       checkUnmatched =
          295|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [ ] then
             |         ^
          296|           let

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

       error: attribute 'default' missing
       at /nix/store/jc38iq38c0g23ilgb60swxj7kb4wsc0y-source/flake.nix:23:9:
           22|       modules = [
           23|         rgit.nixosModules.default
             |         ^
           24|         ./services/rgit.nix

lmk fi you want to see any other files; I think this is probably just a documentation error, but am too unfamiliar with the project to be sure.

MTGmonket avatar May 31 '25 14:05 MTGmonket

This issue is caused by flake-utils. nixosModules is defined in flake-utils instead of outputs directly. Therefore, there is a arch attr between nixosModules and default, such as rgit.nixosModules.x86_64-linux.default. nixos options should define without them I think. @w4

Vonfry avatar Oct 22 '25 05:10 Vonfry