Problems with home-manager

Hi all, I’ve some problems with home-manager:

❄️  marco …/nixos   main !   14:11   in 30s164ms ❯ home-manager option
error:
       … while evaluating a branch condition
         at /nix/store/gj6hz9mj23v01yvq1nn5f655jrcky1qq-nixos-option.nix:160:1:
          159| in
          160| if !lib.hasAttrByPath path' nixos.config then
             | ^
          161|   throw "Couldn't resolve config path '${lib.showOption path'}'"

       … in the argument of the not operator
         at /nix/store/gj6hz9mj23v01yvq1nn5f655jrcky1qq-nixos-option.nix:160:5:
          159| in
          160| if !lib.hasAttrByPath path' nixos.config then
             |     ^
          161|   throw "Couldn't resolve config path '${lib.showOption path'}'"

       … while evaluating the module argument `inputs' in "/home/marco/nixos/users/marco/home.nix":

       … noting that argument `inputs` is not externally provided, so querying `_module.args` instead, requiring `config`

       … if you get an infinite recursion here, you probably reference `config` in `imports`. If you are trying to achieve a conditional import behavior dependent on `config`, consider importing unconditionally, and using `mkEnableOption` and `mkIf` to control its effect.

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

       error: infinite recursion encountered

there are my files:

❄️  marco …/nixos   main !   14:11  ❯cat flake.nix
{
  description = "NixOS configuration with Home Manager";

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

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

    niri = {
      url = "github:sodiboo/niri-flake";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    #hyprland.url = "github:hyprwm/Hyprland";

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

    flake-utils.url = "github:numtide/flake-utils";
    zen-browser.url = "github:0xc000022070/zen-browser-flake";
    quickshell = {
      url = "github:outfoxxed/quickshell";
      inputs.nixpkgs.follows = "nixpkgs";
    };


    dms = {
      url = "github:AvengeMedia/DankMaterialShell";
      inputs.nixpkgs.follows = "nixpkgs";
      #inputs.dgop.follows = "dgop";
    };

    nix-monitor = {
      url = "github:antonjah/nix-monitor";
      inputs.nixpkgs.follows = "nixpkgs";
    };

  };

  outputs = {
    self,
    nixpkgs,
    home-manager,
    quickshell,
    dms,
    niri,
    #hyprland,
    stylix,
    flake-utils,
    nix-monitor,
    zen-browser,
    ...
  } @ inputs: let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${"x86_64-linux"};
    hostname = "tsar-nix"; # ← SOSTITUISCI CON IL TUO
    username = "marco"; # ← SOSTITUISCI CON IL TUO


    # Configurazione nixpkgs centralizzata
      pkgsConfig = {
        config = {
          allowUnfree = true;
        };
        /*overlays = [
          {caelestia-shell = caelestia-shell.packages.${system}.caelestia-shell;
          caelestia-cli   = caelestia-shell.inputs.caelestia-cli.packages.${system}.caelestia-cli; # eventuali overlay
        }];*/
      };

  in {
    nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem {
      inherit system;

      specialArgs = {inherit inputs;};

      #zen-browser = inputs.zen-browser.packages.${stdenv.hostPlatform.system}.default;
      modules = [
        # Configurazione sistema
        ./hosts/${hostname}/configuration.nix
        ./hosts/${hostname}/users.nix
        #./configuration.nix
        #./users.nix
        stylix.nixosModules.stylix
        ];
    };
    homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
    inherit pkgs;
    extraSpecialArgs = {inherit inputs; };
    modules = [
        ./users/${username}/home.nix
      nix-monitor.homeManagerModules.default
        {
          _module.args.inputs = inputs; # Forza esplicitamente l'argomento inputs
          programs.nix-monitor = {
            enable = true;

            # Required: customize for your setup
            rebuildCommand = [
              "bash" "-c"
              "cd ~/nixos && home-manager switch --flake . 2>&1"
            ];
          };
        }
            ];
   };

    /*homeConfigurations = {
        ${username} = home-manager.lib.homeManagerConfiguration {
          inherit pkgs;
          modules = [
          dankMaterialShell.homeModules.dank-material-shell
          niri.homeModules.niri
          ./users/${username}/home.nix ];
          extraSpecialArgs = {inherit inputs;};
        };
      };*/
  };
}

❄️  marco …/nixos   main !   14:16  ❯ cat users/marco/home.nix
{
  config,
  pkgs,
  inputs,
  lib,
  programs,
  ...
} :
 {
  home.username = "marco";
  home.homeDirectory = "/home/marco";

  imports = [
    #inputs.dankMaterialShell.homeModules.dank-material-shell
    inputs.dms.homeModules.dank-material-shell
    #vimPluginsts.dankMaterialShell.homeModules.niri
    inputs.niri.homeModules.niri
    ../../modules/home/fastfetch
    ./packages-home.nix
    ./starship.nix
    ./zsh.nix
    ./niri.nix
    ./dms.nix
  ];
  home.stateVersion = "25.11"; # Please read the comment before changing.
  nixpkgs.overlays = [ inputs.niri.overlays.niri ];
  programs.niri.package = pkgs.niri-unstable;

  xdg.configFile."DankMaterialShell/settings.json".enable = false;
  programs.fastfetch.enable= true;
 # programs.niri.config = null;
/*programs.niri = {
    #enable = true;
    #package = pkgs.niri;
    # Invece di null, usiamo un set vuoto o lasciamo che DMS lo riempia
    #config = lib.mkForce (builtins.readFile ./niri.kdl);
    settings = lib.mkForce {};
  };*/

xdg.enable = true;
 nixpkgs.config.allowUnfree = true;
  #programs.dankMaterialShell.enable = true;
  # Firefox con supporto native messaging
  programs.firefox = {
    enable = true;
    languagePacks = ["it"];
    nativeMessagingHosts = [
      pkgs.firefoxpwa
    ];
  };

  # workaround: linka il manifest JSON nella cartella utente
  home.file.".mozilla/native-messaging-hosts/firefoxpwa.json".source = "${pkgs.firefoxpwa}/lib/mozilla/native-messaging-hosts/firefoxpwa.json";

  programs.neovim.plugins = [
      pkgs.vimPlugins.nvim-treesitter
      pkgs.vimPlugins.nvim-treesitter.withAllGrammars
  ];
  # Home Manager is pretty good at managing dotfiles. The primary way to manage
  # plain files is through 'home.file'.
  home.file = {
    # # Building this configuration will create a copy of 'dotfiles/screenrc' in
    # # the Nix store. Activating the configuration will then make '~/.screenrc' a
    # # symlink to the Nix store copy.
    # ".screenrc".source = dotfiles/screenrc;

    # # You can also set the file content immediately.
    # ".gradle/gradle.properties".text = ''
    #   org.gradle.console=verbose
    #   org.gradle.daemon.idletimeout=3600000
    # '';
  };

  # Home Manager can also manage your environment variables through
  # 'home.sessionVariables'. If you don't want to manage your shell through Home
  # Manager then you have to manually source 'hm-session-vars.sh' located at
  # either
  #
  #  ~/.nix-profile/etc/profile.d/hm-session-vars.sh
  #
  # or
  #
  #  ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
  #
  # or
  #
  #  /etc/profiles/per-user/marco/etc/profile.d/hm-session-vars.sh
  #
  home.sessionVariables = {
    EDITOR = "nvim";
  };

  # Let Home Manager install and manage itself.
  programs.home-manager.enable = true;
}

home-manager option doesn’t know how to deal with flakes.

I do not know why it looks into /home/marco/nixos/users/marco/home.nix in the first place, but for sure it doesn’t use the flake output to determine that.