Infinite Recursion

building the system configuration...
evaluating derivation 'path:/etc/nixos#nixosConfigurations."desktop2".config.system.build.toplevel'error: stack overflow (possible infinite recursion)

This is the error message I get when I try to build my system. It is because I am trying to inherit a flake input in home manager. Shouldn’t it be able to do this?

My flake.nix:

{
  description = "A NixOS configuration for my personal computers";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";

    hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";

    rose-pine-hyprcursor.url = "github:ndom91/rose-pine-hyprcursor";

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

  outputs = inputs@{ nixpkgs, nixpkgs-stable, home-manager, ...}:
  let

  in {
    nixpkgs.config.allowUnfree = true;

    nixosConfigurations = {
      desktop2 = nixpkgs.lib.nixosSystem {
        specialArgs = { inherit inputs; };

	system = "x86_64-linux";

	modules = [
	 ./desktop/configuration.nix

	 home-manager.nixosModules.home-manager {
	   home-manager.extraSpecialArgs = { inherit inputs; };
	   home-manager.users.corbin = import ./users/corbin/desktop/home.nix;
	 }
	];
      };
    };
  };
}

My home.nix:

{ config, pkgs, lib, inputs, ... }: {
  imports = [
    ./../wms/hyprland.nix
  ];

  home = {
    username = "corbin";
    homeDirectory = "/home/corbin";

    stateVersion = "24.11";
  };

  programs.home-manager.enable = true;
}

My hyprland.nix:

{ pkgs, lib, config, inputs, ... }:
let
  startupScript = pkgs.pkgs.writeShellScriptBin "start" ''
    ${pkgs.ags}/bin/ags &
    ${pkgs.waypaper}/bin/waypaper --restore &
    ${pkgs.polkit_gnome}/libexec/polkit/gnome-authentication-agent-1 &
  '';
in {
  wayland.windowManager.hyprland = {
    enable = true;
    settings = {
      exec-once = ''${startupScript}/bin/start'';

      env = [
        "ELECTRON_OZONE_PLATFORM_HINT,auto"
        "HYPRCURSOR_THEME,rose-pine-hyprcursor"
	"XCURSOR_SIZE,24"
      ];

      monitor = [
        "DP-2,3840x2160@150,0x0,1.5"
        "DP-1,1920x1200@60,2560x-500,1,transform,3"
      ];

      xwayland.force_zero_scaling = true;

      input = {
        kb_layout = "us";

	follow_mouse = 1;
      };

      general = {
        gaps_in = 7;
	gaps_out = 14;

	border_size = 0;

	layout = "dwindle";
      };

      decoration = {
        rounding = 10;
    
        blur = {
          enabled = true;

          size = 2;
          passes = 4;
          noise = 0;
          brightness = 0.7;
          vibrancy = 0.6;
          contrast = 0.9;

          new_optimizations = true;

          popups = 1;
	};

	drop_shadow = "no";
	shadow_range = 40;
	shadow_render_power = 4;
	"col.shadow" = "rgba(1a1a1a60)";

	blurls = [
	 "dunst"
	 "ags-bar"
	 "top-bar"
	];

	layerrule = [
	 "blur, notifications"
	 "layerrule=blur, notifications"
          "layerrule=ignorezero, notifications"
          "ignorezero, ulauncher"
          "ignorezero, launcher"
          "blur, ags-drawer"
          "blur, ags-bar,"
          "blur, quick-settings"
          "ignorezero, quick-settings"
          "blur, volume-popup"
          "ignorezero, volume-popup"
          "blur, desktop-context-menu"
          "ignorezero, desktop-context-menu"
	];
      };

      animations = {
        enabled = "yes";

	bezier = [
	 "openBezier, 0.2, 0.9, 0.1, 1.05"
	 "workspaceBezier, 0.4, 0.9, 0.1, 1"
	];

	animation = [
	 "windows, 1, 7, openBezier"
          "windowsOut, 1, 7, default, popin 80%"
          "border, 1, 10, default"
          "borderangle, 1, 8, default"
          "fade, 1, 7, default"
          "workspaces, 1, 7, workspaceBezier, slide"
	];
      };

      packages = with inputs; [
        rose-pine-hyprcursor.packages."x86_64-linux".default
      ];
    };
  };
}

shout out to the person who came here just to change the tag and not to answer

Don’t be rude, they may not have known or just been doing janitorial work.

Im doing the same thing but outputs = inputs: so the specialArgs shouldn’t be the issue

The toplevel nixpkgs.config isn’t being passed to the nixpkgs import, remove it to make sure theres no weird interaction.

Did you try commenting the home-manager part and evalling? Try to minimalize the config as much as possible.

Did you try -vvvvvvv

1 Like

Volunteers do not owe you answers. This is not a commercial support forum.

Please refrain from adopting this kind of aggressive self-entitled tone.

5 Likes

Hi, can you please provide the contents of ./desktop/configuration.nix?