I’m currently trying to debug a NixOS module. Here’s a similar version of the module:
{ config, pkgs, lib, ... }:
let
yaml = pkgs.formats.yaml { };
in
{
options.services.yes = {
settings = lib.mkOption {
type = lib.types.submodule {
options = {
general = lib.mkOption {
type = lib.types.submodule {
freeformType = yaml.type;
options = {
# paths = {
# config_dir = lib.mkOption {
# type = lib.types.path;
# default = "/etc/yes";
# };
# };
};
};
};
};
};
};
};
config =
let
cfg = config.services.yes;
in
{
services.yes.settings.general = rec {
paths = {
# config_dir = lib.mkDefault "/etc/yes";
sub_dir = lib.mkDefault "${paths.config_dir.ctiegsnrctiel.ctiencduelm}/sub_dir";
};
};
};
}
Funny enough, if I add this file to the imports list, I’d expect an error due to the ridiculous variable paths.config_dir.ctiegsnrctiel.ctiencduelm but sudo nixos-rebuild test --flake . suprisingly succeeded… and I’m confused. Why does it pass? I expected to get an error that tells me that paths.config_dir.ctiegsnrctiel.ctiencduelm isn’t set.