Skip to content

Overlay-based /etc build is failing when the system timezone is set #311125

@ivan770

Description

@ivan770

Describe the bug

error: builder for '/nix/store/lkvz4rg9p91r1hl6c5vfhc82wc0572rs-etc-lowerdir.drv' failed with exit code 1;
       last 1 log lines:
       > cp: cannot stat '/etc/zoneinfo/Utc': No such file or directory
       For full logs, run 'nix log /nix/store/lkvz4rg9p91r1hl6c5vfhc82wc0572rs-etc-lowerdir.drv'.

Locale module is the only place in nixpkgs that mentions direct-symlink etc entry type:

localtime.mode = "direct-symlink";

/etc overlay generation code acknowledges the existence only of the symlink type (

etcHardlinks = filter (f: f.mode != "symlink") etc';
).

Steps To Reproduce

nixpkgs.lib.nixosSystem {
  system = "x86_64-linux";
  modules = [
    {
      fileSystems."/" = {
        device = "none";
        fsType = "tmpfs";
      };
      boot.loader.grub.enable = false;
      boot.initrd.systemd.enable = true;
      system.etc.overlay = {
        enable = true;
        mutable = true;
      };
      time.timeZone = "Utc";
    }
  ];
}

Expected behavior

The provided system configuration builds.

Notify maintainers

Mentioning @nikstur since they committed the /etc overlay code.

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.7, NixOS, 23.11 (Tapir), 23.11.20240424.dd37924`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/etc/nix/inputs/nixpkgs`

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions