nix-gui / nix-gui

Use NixOS Without Coding
MIT License
655 stars 23 forks source link

error: attribute 'cycle' missing. The ‘fileSystems’ option can't be topologically sorted #276

Open milahu opened 1 year ago

milahu commented 1 year ago
cd nix-gui
nix develop
cd nixui
p=/nix/store/ip17r412b9by9nwb0ri0avrzhvv49ajc-source
export NIX_PATH=$p:nixpkgs=$p:nixos-config=$(readlink -f tests/sample/configuration.nix)

# workaround for https://github.com/nix-gui/nix-gui/issues/275
sed -i '/echo ${toString config.services.nix-serve.port}/d' tests/sample/configuration.nix

pytest -svv tests/test_api.py::test_get_option_tree
)
>               raise NixEvalError(err_str)
E               nixui.options.nix_eval.NixEvalError: NixEvalError("""
E               error: attribute 'cycle' missing
E               
E                      at /nix/store/ip17r412b9by9nwb0ri0avrzhvv49ajc-source/nixos/modules/tasks/filesystems.nix:259:119:
E               
E                         258|       { assertion = ! (fileSystems' ? cycle);
E                         259|         message = "The ‘fileSystems’ option can't be topologically sorted: mountpoint dependency path ${ls " -> " fileSystems'.cycle} loops to ${ls ", " fileSystems'.loops}";
E                            |                                                                                                                       ^
E                         260|       }

https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix#L277


  ###### implementation

  config = {

    assertions = let
      ls = sep: concatMapStringsSep sep (x: x.mountPoint);
      notAutoResizable = fs: fs.autoResize && !(hasPrefix "ext" fs.fsType || fs.fsType == "f2fs");
    in [
      { assertion = ! (fileSystems' ? cycle);
        message = "The ‘fileSystems’ option can't be topologically sorted: mountpoint dependency path ${ls " -> " fileSystems'.cycle} loops to ${ls ", " fileSystems'.loops}";
      }
      { assertion = ! (any notAutoResizable fileSystems);
        message = let
          fs = head (filter notAutoResizable fileSystems);
        in
          "Mountpoint '${fs.mountPoint}': 'autoResize = true' is not supported for 'fsType = \"${fs.fsType}\"':${if fs.fsType == "auto" then " fsType has to be explicitly set and" else ""} only the ext filesystems and f2fs support it.";
      }
    ];