den icon indicating copy to clipboard operation
den copied to clipboard

BUG: home-manager option is missing when strict user checking is enabled

Open jonathanchancey opened this issue 2 months ago • 1 comments

Hello first I love the framework, it's saving me from an Ansible dotfiles monstrosity I've been lugging around for years. Anyways, on to the report.

Upon updating den to 6c11a13, I hit a bug with strict user checking enabled introduced from #680.

Note: I couldn't reproduce with denTest as it uses its own home manager user and doesn't break.

Here's a minimal example to reproduce:

{
  inputs = {
    den.url = "github:denful/den/6c11a13d555347c7928ea18fab5ef73dae4c3840"; # first failing commit
    # den.url = "github:denful/den/85b4e520e65a729685f69978fa758e15536ede15"; # last working commit
    nixpkgs.url = "github:nixos/nixpkgs/e94cb152ed51bd6e24eb4a41f1460252beb52cd2";
    home-manager = {
      url = "github:nix-community/home-manager/7b4c5ec4bedaf1e062bbc1bcaeddbc6bd242aa1b";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = inputs: (inputs.nixpkgs.lib.evalModules {
    specialArgs = { inherit inputs; };
    modules = [
      inputs.den.flakeModule
      ({ den, lib, ... }: {
        den = {
          schema.user = {
            imports = [ den.lib.strict ];
            classes = lib.mkDefault [ "homeManager" ];
          };
          hosts.x86_64-linux.igloo.users.tux = { };
          aspects.igloo.nixos.home-manager.sharedModules = [
            {
              home = {
                stateVersion = "25.05";
                sessionVariables.exampleVariable = "ok";
              };
            }
          ];
        };
      })
    ];
  }).config.flake;
}

Intended behavior, output from last working commit (bisect)

$ nix eval --raw .#nixosConfigurations.igloo.config.home-manager.users.tux.home.sessionVariables.exampleVariable

• Updated input 'den':
    'github:denful/den/6c11a13d555347c7928ea18fab5ef73dae4c3840?narHash=sha256-sbsoBukgIqvPS0ppJGxYaJzuq2GyE1V4dmtG9YIbgMc%3D' (2026-09-15)
  → 'github:denful/den/85b4e520e65a729685f69978fa758e15536ede15?narHash=sha256-J085WbR/RANoUkAwlEV34m9AjpQvkoW9oLgk3JGSIsE%3D' (2026-09-15)
ok⏎

Actual behavior, output from first failing commit

$ nix eval --raw .#nixosConfigurations.igloo.config.home-manager.users.tux.home.sessionVariables.exampleVariable

• Updated input 'den':
    'github:denful/den/85b4e520e65a729685f69978fa758e15536ede15?narHash=sha256-J085WbR/RANoUkAwlEV34m9AjpQvkoW9oLgk3JGSIsE%3D' (2026-09-15)
  → 'github:denful/den/6c11a13d555347c7928ea18fab5ef73dae4c3840?narHash=sha256-sbsoBukgIqvPS0ppJGxYaJzuq2GyE1V4dmtG9YIbgMc%3D' (2026-09-15)
error:
       … while calling the 'seq' builtin
         at «github:nixos/nixpkgs/e94cb152ed51bd6e24eb4a41f1460252beb52cd2?narHash=sha256-VVTPf%2BHyd5ebpjBMHmrLMSBIeW6ls48Bqtosj7CNKLA%3D»/lib/modules.nix:404:18:
          403|         options = checked options;
          404|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          405|         _module = checked (config._module);

       … while calling the 'throw' builtin
         at «github:nixos/nixpkgs/e94cb152ed51bd6e24eb4a41f1460252beb52cd2?narHash=sha256-VVTPf%2BHyd5ebpjBMHmrLMSBIeW6ls48Bqtosj7CNKLA%3D»/lib/modules.nix:376:13:
          375|           else
          376|             throw baseMsg
             |             ^
          377|         else

       error: The option `home-manager' does not exist. Definition values:
       - In `nixos@igloo':
           {
             sharedModules = [
               {
                 home = {
                   sessionVariables = {
           ...

       Did you mean `image', `powerManagement' or `containers'?

Confirmed still present in latest main d0d80fa, Nix 2.34.8, x86_64-linux

This may be known. I see there are plans to replace the strict mode system in #632. For now I'll expand on the workaround and disable user strict checking.

Cheers!

jonathanchancey avatar Sep 27 '26 16:09 jonathanchancey

This works on current main. Your flake from the report evaluates to ok. Strict mode was reworked in #717, and that's almost certainly what fixed it. The imports = [ den.lib.strict ] spelling still works but now warns; the new form is den.schema.user = den.lib.strict; (or isStrict = true). Closing, but reopen if you still see it on a recent rev.

sini avatar Dec 04 '26 23:12 sini