Skip to content

nixos/cups-pdf: funny module system eval error #438459

@eclairevoyant

Description

@eclairevoyant

Nixpkgs version

  • Unstable (25.11)

Describe the bug

:)

Steps to reproduce

Run nixos-rebuild dry-build --flake .#test on the following flake.nix in an empty directory.

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs";
  };

  outputs =
    { nixpkgs, ... }:
    {
      nixosConfigurations.test = nixpkgs.lib.nixosSystem {
        modules = [
          (
            { modulesPath, ... }:
            {
              imports = [ "${modulesPath}/profiles/minimal.nix" ];

              boot.loader.grub.enable = false;
              fileSystems."/".device = "nodev";
              nixpkgs = {
                hostPlatform = "x86_64-linux";
              };
              system.stateVersion = "24.05";

              users = {
                mutableUsers = false;
                users.test = {
                  password = "meow";
                  isNormalUser = true;
                  group = "wheel";
                  createHome = true;
                };
              };

              # custom config here
              services.printing.cups-pdf = {
                enable = true;
                instances.pdf = {
                  settings = {
                    Out = "\${HOME}/cups-pdf";
                    UserUMask = "0033";
                  };
                };
              };
            }
          )
        ];
      };
    };
}

Expected behaviour

:)

Screenshots

No response

Relevant log output

error:
       … while calling the 'head' builtin
         at /nix/store/4958qgda8h4lb0vbbmxq8lrzq781zpv4-source/lib/attrsets.nix:1544:13:
         1543|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1544|             head values
             |             ^
         1545|           else

       … while evaluating the attribute 'value'
         at /nix/store/4958qgda8h4lb0vbbmxq8lrzq781zpv4-source/lib/modules.nix:1118:7:
         1117|     // {
         1118|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1119|       inherit (res.defsFinal') highestPrio;

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

       error: evaluation aborted with the following error message: '(t.merge.v2 defs).value must only be accessed when `.headError == null`. This is a bug in code that consumes a module system type.'
Command 'nix --extra-experimental-features 'nix-command flakes' build --print-out-paths '/tmp/tmp.8Oc4djGJTs#nixosConfigurations."test".config.system.build.toplevel' --dry-run' returned non-zero exit status 1.

Additional context

No response

System metadata

fails on nixpkgs master (e50b14b)
also fails on nixos-unstable (dfb2f12)

I don't really want to bisect it but known good revision is 3b9f00d

Notify maintainers

I don't know the right person to tag here.

@hsjobeki since you wrote the error and are most familiar with it
@Yarny0 since you wrote the cups-pdf module and no one has actually touched it since


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions