modules: expose stabilizeApp and mkAppBundle as config.lib.appIdentity #3

Merged
natsukium merged 1 commit from config-lib-app-identity into main 2026-09-20 15:10:30 +09:00
Owner

Why

Every consumer module that owns a package option (programs.kitty.package, services.skhd.package) or a launchd agent has had to repeat pkgs.callPackage inputs.nix-mac-app-identity { } to reach stabilizeApp / mkAppBundle, even though the home-manager or nix-darwin module is already imported. In natsukium/dotfiles that line appears in eight modules.

What

  • The shared module (modules/options.nix) defines config.lib.appIdentity = { stabilizeApp; mkAppBundle; } unconditionally, so it is available with an empty apps list. No options.lib is declared here; home-manager and nix-darwin both provide it. The name mirrors the option path (targets.darwin.appIdentity).
  • tests/modules.nix adds evaluation-only checks with stubbed host options: helpers present with empty apps (HM and nix-darwin), same drvPath as the callPackage route, apps behavior unchanged, coexistence with another config.lib.* definition, a Linux package set that forces nothing Darwin-only, and a parent module feeding a submodule option.
  • README gains a "From another module" section with the constraints (not usable in imports, submodules need the parent to pass it in, unsupported to apply on Linux). CHANGELOG lists the addition under Unreleased.
## Why Every consumer module that owns a package option (`programs.kitty.package`, `services.skhd.package`) or a launchd agent has had to repeat `pkgs.callPackage inputs.nix-mac-app-identity { }` to reach `stabilizeApp` / `mkAppBundle`, even though the home-manager or nix-darwin module is already imported. In natsukium/dotfiles that line appears in eight modules. ## What - The shared module (`modules/options.nix`) defines `config.lib.appIdentity = { stabilizeApp; mkAppBundle; }` unconditionally, so it is available with an empty `apps` list. No `options.lib` is declared here; home-manager and nix-darwin both provide it. The name mirrors the option path (`targets.darwin.appIdentity`). - `tests/modules.nix` adds evaluation-only checks with stubbed host options: helpers present with empty `apps` (HM and nix-darwin), same `drvPath` as the `callPackage` route, `apps` behavior unchanged, coexistence with another `config.lib.*` definition, a Linux package set that forces nothing Darwin-only, and a parent module feeding a submodule option. - README gains a "From another module" section with the constraints (not usable in `imports`, submodules need the parent to pass it in, unsupported to apply on Linux). CHANGELOG lists the addition under Unreleased.
modules: expose stabilizeApp and mkAppBundle as config.lib.appIdentity
Some checks failed
ci / nix flake check (pull_request) Failing after 21s
43592aa0ae
Consumers previously had to repeat `pkgs.callPackage inputs.nix-mac-app-identity { }` in every module that owns a package option (such as `programs.kitty.package`) or a launchd agent.

`config.lib` was chosen over `_module.args` because a same-name `specialArgs` value would silently win, module arguments are not inherited by submodules, and the argument's origin would be invisible at the call site.

The short namespace `config.lib.appIdentity` accepts the trade-off of potential shallow collision with same-name definitions from other modules, keeping call sites concise and consistent with the option path.

Assisted-by: Claude Code:Fable 5.1
natsukium force-pushed config-lib-app-identity from 43592aa0ae
Some checks failed
ci / nix flake check (pull_request) Failing after 21s
to 7542049aed
Some checks failed
ci / nix flake check (pull_request) Failing after 21s
2026-09-20 15:05:00 +09:00
Compare
natsukium force-pushed config-lib-app-identity from 7542049aed
Some checks failed
ci / nix flake check (pull_request) Failing after 21s
to 518a4959ed
All checks were successful
ci / nix flake check (pull_request) Successful in 27s
2026-09-20 15:06:07 +09:00
Compare
natsukium deleted branch config-lib-app-identity 2026-09-20 15:10:30 +09:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
natsukium/nix-mac-app-identity!3
No description provided.