Been debugging my build since yesterday, still not getting anywhere.
I am getting error when trying to build my picom
$ sudo nixos-rebuild switch --flake .#mXlaptop
error: infinite recursion encountered
at /nix/store/v30d42gs5j2x46486d3jrx23hr9qhdvh-source/lib/modules.nix:283:21:
282| (regularModules ++ [ internalModule ])
283| ({ inherit lib options config specialArgs; } // specialArgs);
| ^
284| in mergeModules prefix (reverseList collected);
(use '--show-trace' to show detailed location information)
my picom.nix
{pkgs, lib, config, ...}:
with lib;
with builtins;
let
cfg = config.services.picom;
opt = options.services.picom;
in {
config = cfg.enable {
environment.systemPackages = with pkgs; [
picom
];
services.picom = {
enable = true;
fade = true;
fadeDelta = 5;
shadow = true;
backend = "glx";
};
};
}
I cannot see what is wrong, how it ends up in an infinite recursion?
NobbZ
July 24, 2022, 11:27am
2
As I explained yesterday, you are not allowed to use this construct.
Your condition might be altered within the gated settings, this causes infinite recursion.
Please would you be so kind to show what can be changed to make this work?
NobbZ
July 24, 2022, 11:37am
4
If you are lucky, removing enable = true
might already work.
I can’t currently test it though.
My personal preference though would be to create a complete different option to be used as a “gate”, like options.merrinx.picom.enable = lib.mkEnableOption "picom"
and check for that value as condition for lib.mkIf
It did not work to remove enable = true, could give a more example on how you ment for me to do the other option?
I changed the config = mkIf cfg.enable
And now it builds, however when i try to run picom, there is no package named picom
NobbZ
July 24, 2022, 12:14pm
7
Well, you changed to what?
An example of what I meant can be seen in my configs.
config,
pkgs,
lib,
...
}: let
base = "/etc/nixpkgs/channels";
nixpkgsPath = "${base}/nixpkgs";
nixpkgs2105Path = "${base}/nixpkgs2105";
nixpkgs2111Path = "${base}/nixpkgs2111";
in {
options.nix.flakes.enable = lib.mkEnableOption "nix flakes";
config = lib.mkIf config.nix.flakes.enable {
nix = {
package = lib.mkDefault nix.packages.x86_64-linux.nix; # pkgs.nixUnstable;
experimentalFeatures = "nix-command flakes";
registry.nixpkgs.flake = unstable;
registry.nixpkgs2105.flake = nixpkgs-2105;
registry.nixpkgs2111.flake = nixpkgs-2111;
To actually use this I have to set nix.flakes.enable = true
for all systems that shall use flakes.
While I set it per machine at the beginning when I was in transition phase, I just set it unconditionally today:
This is my picom.nix
{pkgs, lib, config, ...}:
with lib;
with builtins;
let
cfg = config.services.picom;
opt = options.services.picom;
in {
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
picom
];
services.picom = {
# enable = true;
fade = true;
fadeDelta = 5;
shadow = true;
backend = "glx";
};
};
}
and this is my flake.nix
{
description = "MerrinX Flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/release-21.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
dwm.url = "github:gako358/dwm";
st.url = "github:gako358/st";
};
outputs = { self, nixpkgs, home-manager, dwm, st }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
lib = nixpkgs.lib;
overlay = [
dwm.overlays.default
st.overlays.default
];
in {
homeManagerConfigurations = {
merrinx = home-manager.lib.homeManagerConfiguration {
inherit system pkgs;
username = "merrinx";
homeDirectory = "/home/merrinx";
configuration = {
imports = [
./modules/users/merrinx/home.nix
];
};
};
};
nixosConfigurations = {
mXlaptop = lib.nixosSystem {
inherit system;
modules = [
./modules
{ nixpkgs.overlays = overlay; }
];
};
};
};
}
Everything builds but there is no Picom available, what am I missing?
NobbZ
July 24, 2022, 12:39pm
9
Where do you set services.picom.enable
?
you are correct, and when I change it back to just cfg.enable, i get hit back with infinite recursion, I am lost… How can I get it build, what am i doing wrong?
NobbZ
July 24, 2022, 1:06pm
11
Use a proxy option, as already mentioned, that’s probably the easiest to do.
I understand that you have explained, it, but I do not understand how to implement it, If you could please explain more in depth or give a solid example how I would implement it in my system it would be much appreciated
NobbZ
July 24, 2022, 1:10pm
13
Well, you changed to what?
An example of what I meant can be seen in my configs.
To actually use this I have to set nix.flakes.enable = true for all systems that shall use flakes.
While I set it per machine at the beginning when I was in transition phase, I just set it unconditionally today:
I’m not sure what is missing from that example.
That I do not understand where I am to set nix.flakes.enable in my system and how that would solve the infinite recursion, and how I will get to build picom?
NobbZ
July 24, 2022, 1:22pm
15
You probably don’t want to call it nix.flakes.enable
, but something more meaningful to your picom.
It solves by not making the value of cfg
not depend on cfg
anymore.
You set it somewhere in your systems main entry point. Or inline in the nixosSystem
call.
Could you please give an example on how to do this on my system?
NobbZ
July 24, 2022, 2:32pm
17
# picom.nix
{pkgs, lib, config, ...}:
let
cfg = config.merrinx.picom;
in {
options.merrinx.picom.enable = lib.mkEnableOption "picom";
config = lib.mkIf cfg.enable {
environment.systemPackages = [pkgs.picom];
services.picom = {
enable = true;
fade = true;
fadeDelta = 5;
shadow = true;
backend = "glx";
};
};
}
and
[…]
mXlaptop = lib.nixosSystem {
inherit system;
modules = [
./modules
{ merrinx.picom.enable = true; }
{ nixpkgs.overlays = overlay; }
];
};
[…]
Or, create a “main entry point” for your system which you add to the modules
list and that is unique to that one system in which you then enable the merrinx.picom.enable
.
I am truly sorry for troubling you with all these questions, but this worked, and it made sense to me on how to continue adding more features. Thank you so much for keeping up with my nagging…