Error: Infinite recursion encountered #4054
-
|
When I was configuring NixVim, NixOS threw an error: Here's my configurations: # flake.nix
{
description = "Twominus' NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
noctalia = {
url = "github:noctalia-dev/noctalia-shell";
inputs.nixpkgs.follows = "nixpkgs";
# inputs.quickshell.follows = "quickshell";
};
quickshell = {
url = "github:outfoxxed/quickshell";
inputs.nixpkgs.follows = "nixpkgs";
};
zen-browser = {
url = "github:youwen5/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
in
{
nixosConfigurations.Albert-NixOS-PC = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.Albert = import ./home.nix;
home-manager.extraSpecialArgs = inputs;
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
}
];
};
};
}# home.nix
{ config, pkgs, inputs, ... }:
{
imports = [ inputs.nixvim.homeModules.nixvim ];
home.username = "Albert";
home.homeDirectory = "/home/Albert";
home.packages = with pkgs; [
# CLI
btop
cmatrix
fastfetch
# Shell
zim
zsh
# Programming
python
# Terminal
ghostty
# Text
obsidian
zed
# Web
wget
];
# Git
programs.git = {
enable = true;
settings = {
user.name = "Twominus";
user.email = "albert.peng0826@foxmail.com";
};
};
# Libvirt
# virtualisation.libvirtd = {
# enable = true;
# qemu.vhostUserPackages = with pkgs; [ virtiofsd ];
# };
# NixVim
programs.nixvim = {
enable = true;
config = {
imports = [ ./home/nixvim ];
};
};
# Virt-manager
# programs.virt-manager.enable = true;
home.stateVersion = "26.05";
}How to fix the problem? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
This shouldn't cause inf-recursion, but the first issue I spotted is: programs.nixvim = {
+ imports = [ ./home/nixvim ];
- enable = true;
config = {
+ enable = true;
- imports = [ ./home/nixvim ];
};
};
In this case, you don't actually need to say programs.nixvim = {
enable = true;
imports = [ ./home/nixvim ];
};Two issues here: home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
- home-manager.users.Albert = import ./home.nix;
+ home-manager.users.Albert = ./home.nix;
- home-manager.extraSpecialArgs = inputs;
+ home-manager.extraSpecialArgs = { inherit inputs; };
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
}
|
Beta Was this translation helpful? Give feedback.
This shouldn't cause inf-recursion, but the first issue I spotted is:
programs.nixvim = { + imports = [ ./home/nixvim ]; - enable = true; config = { + enable = true; - imports = [ ./home/nixvim ]; }; };importsis not a config option; it is a special module-system attr that lists other modules to import.enableis a config option, and should be defined under the special module-system attrconfigto separate it from imports and options.In this case, you don't actually need to say
config. That's usually only needed if you also declare options. When you only have config definitions and imports listed, you can use the "shorthand" module shape:p…