Skip to content

applications: do not preserve Nix store timestamps when copying app bundles #1842

Open

Description

@TyceHerrman

Description

nix-darwin copies application bundles out of the Nix store with rsync --archive:

--archive implies timestamp preservation. Nix store paths have normalized
timestamps, commonly mtime = 1, so those timestamps are also applied to the
copied app bundle.

Home Manager documented a code-signing failure observed on macOS 26.3 when an
app bundle had mtime = 1, and stopped copying file timestamps in
nix-community/home-manager#9099:

macOS throws a code signing error when the modification time on an app is set
to 1.

The PR author explicitly qualified the version boundary:

This seems to have started on macOS 26.3, but I'm not fully sure.

This should therefore not be treated as a macOS 26.3-specific bug. The
confirmed claim is narrower: the failure was observed there. Independently of
which macOS release first exposed the problem, a mutable application
installation should not inherit Nix store timestamp normalization unless those
timestamps are semantically required.

The Home Manager fix replaced --archive with explicit copy flags that omit
timestamp preservation. That is the right principle, but it is not sufficient
for nix-darwin on its own.

Why the Home Manager change is not sufficient

It does not change nix-darwin's copiers

Home Manager and nix-darwin have independent activation code and destinations.
Home Manager #9099 only changes apps copied from home.packages into
~/Applications/Home Manager Apps. It does not change nix-darwin's
/Applications/Nix Apps copier or its direct /Applications/1Password.app
copier, both of which still use --archive.

It does not necessarily repair an existing destination

Omitting timestamp preservation prevents a fresh copy from acquiring the
source's normalized timestamp. It does not necessarily update an unchanged
destination that was copied by an earlier activation and already has
mtime = 1.

With rsync 3.4.4, an app-shaped test fixture copied once with the current
archive semantics retained mtime = 1 after a second, content-identical sync
using explicit non-timestamp-preserving flags. The source content did not need
to be transferred, so the previously copied destination metadata remained.

The change therefore needs a migration path as well as new copy semantics:
either force replacement/re-copy when adopting the new behavior, or explicitly
normalize existing destination app bundles whose top-level modification time
is still 1.

It does not solve location-sensitive application requirements

This issue is only about copy metadata. It does not make
~/Applications/Home Manager Apps or /Applications/Nix Apps equivalent to a
bundle installed directly as /Applications/<Name>.app.

Applications whose system extensions or helpers require that direct location
still need a separate installation mechanism. In particular, fixing timestamp
preservation alone is not the complete fix for Proton VPN's system-extension
activation.

Existing nix-darwin context

The review for
nix-darwin#1396
already notes that Nix store mtimes are standardized and therefore
--checksum is required for change detection. However, the resulting copier
still uses --archive, so it preserves those standardized timestamps at the
destination.

I could not find an existing nix-darwin issue, pull request, commit, or
Discussion covering this mtime = 1 application-copy problem.

Expected behavior

Applications copied to /Applications/Nix Apps or directly to
/Applications should retain nix-darwin's existing content, symlink,
permission, and ownership behavior without inheriting Nix store timestamps
that can interfere with macOS code-signing assessment or cached code-signing
state.

An activation after the fix should also repair app bundles previously copied
with a top-level mtime = 1, even when their contents have not changed.

Suggested change

Stop preserving timestamps in each nix-darwin app-copying path.

One option is to expand --archive into explicit flags that preserve its
currently desired behavior while omitting --times, following the principle
used by Home Manager #9099. A smaller alternative is to explicitly cancel
timestamp preservation with --no-times.

The change should retain nix-darwin's current read-only destination permissions
and ownership semantics rather than copying Home Manager's complete flag list
verbatim.

Include a bounded, one-time-compatible repair for existing destination app
bundles whose top-level modification time is 1. This avoids leaving affected
installations broken indefinitely just because their source contents remain
unchanged.

The same rule should also be applied to new direct-copy application modules so
the behavior does not diverge between /Applications/Nix Apps and
app-specific /Applications/<Name>.app destinations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions