nix-community / impermanence

Modules to help you handle persistent state on systems with ephemeral root storage [maintainer=@talyz]
MIT License
1.01k stars 76 forks source link

Infinite recursion error when persisting anything in /var/ #176

Open alyraffauf opened 3 months ago

alyraffauf commented 3 months ago

Hello,

I'm using impermanence with btrfs subvolumes, deleting and recreating / on boot. When I use environment.persistence with directories in /etc/, my system builds fine. But when I try to persist, say, /var/log, it fails with an infinite recursion.

In other words, this works:

  environment.persistence."/persist" = {
    hideMounts = true;
    directories = [
      "/etc/NetworkManager/system-connections"
    ];
    files = [
      "/etc/machine-id"
    ];
  };

But this does not:

  environment.persistence."/persist" = {
    hideMounts = true;
    directories = [
      "/etc/NetworkManager/system-connections"
      "/var/log"
    ];
    files = [
      "/etc/machine-id"
    ];
  };

Here is the output of nixos-rebuild:

[aly@lavaridge:~/nixcfg] $ sudo nixos-rebuild build --flake .#rustboro
building the system configuration...
warning: Git tree '/home/aly/nixcfg' is dirty
error:
       … while calling the 'head' builtin

         at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/attrsets.nix:1541:11:

         1540|         || pred here (elemAt values 1) (head values) then
         1541|           head values
             |           ^
         1542|         else

       … while evaluating the attribute 'value'

         at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

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

       error: infinite recursion encountered

       at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/modules.nix:1001:14:

         1000|     { _type = "if";
         1001|       inherit condition content;
             |              ^
         1002|     };

I'm on nixos unstable 24.05.

anna328p commented 3 months ago

Could you run nixos-rebuild with the option --show-trace, then upload the output as a Gist?