A macOS utility to track home-manager JJ repo status

Add home-manager module for launchd integration

Adds a home-manager module that allows users to enable the app as a
launchd user agent via `programs.jj-home-manager-status.enable`.

Changes:
- Move nix files under `nix/` directory for better organization
- Export `homeManagerModules.default` and `homeManagerModules.jj-home-manager-status`
- Module configures launchd agent with RunAtLoad and KeepAlive
- Add `package` option for flexibility (defaults to pkgs.home-manager-status)

Usage in consumer flake:

```nix
{
imports = [ jj-home-manager-status.homeManagerModules.default ];
programs.jj-home-manager-status = {
enable = true;
package = jj-home-manager-status.packages.\${pkgs.system}.default;
};
}
```

AI-assisted: GitLab Duo Agentic Chat (Claude Opus 4.5)

+54 -7
+6 -1
flake.nix
··· 22 22 inputs.treefmt-nix.flakeModule 23 23 ]; 24 24 25 + flake = { 26 + homeManagerModules.default = import ./nix/modules/home-manager.nix; 27 + homeManagerModules.jj-home-manager-status = import ./nix/modules/home-manager.nix; 28 + }; 29 + 25 30 perSystem = 26 31 { pkgs, ... }: 27 32 { 28 - packages.default = pkgs.swiftPackages.callPackage ./package.nix { }; 33 + packages.default = pkgs.swiftPackages.callPackage ./nix/package.nix { }; 29 34 30 35 treefmt = { 31 36 projectRootFile = "flake.nix";
+42
nix/modules/home-manager.nix
··· 1 + { 2 + config, 3 + lib, 4 + pkgs, 5 + ... 6 + }: 7 + 8 + let 9 + cfg = config.programs.jj-home-manager-status; 10 + in 11 + { 12 + options.programs.jj-home-manager-status = { 13 + enable = lib.mkEnableOption "HomeManagerStatus menu bar app for jj repo status"; 14 + 15 + package = lib.mkOption { 16 + type = lib.types.package; 17 + default = pkgs.home-manager-status or null; 18 + defaultText = lib.literalExpression "pkgs.home-manager-status"; 19 + description = "The HomeManagerStatus package to use."; 20 + }; 21 + }; 22 + 23 + config = lib.mkIf cfg.enable { 24 + assertions = [ 25 + { 26 + assertion = cfg.package != null; 27 + message = "programs.jj-home-manager-status.package must be set. Either add home-manager-status to your pkgs overlay or set this option directly."; 28 + } 29 + ]; 30 + 31 + launchd.agents.HomeManagerStatus = { 32 + enable = true; 33 + config = { 34 + ProgramArguments = [ 35 + "${cfg.package}/Applications/HomeManagerStatus.app/Contents/MacOS/HomeManagerStatus" 36 + ]; 37 + RunAtLoad = true; 38 + KeepAlive = true; 39 + }; 40 + }; 41 + }; 42 + }
+6 -6
package.nix nix/package.nix
··· 10 10 version = "0.1.0"; 11 11 12 12 src = lib.fileset.toSource { 13 - root = ./.; 13 + root = ./..; 14 14 fileset = lib.fileset.unions [ 15 - ./Package.swift 16 - ./Sources 17 - ./Tests 18 - ./Info.plist 15 + ./../Package.swift 16 + ./../Sources 17 + ./../Tests 18 + ./../Info.plist 19 19 ]; 20 20 }; 21 21 ··· 39 39 mkdir -p "$APP/Contents/MacOS" 40 40 41 41 cp "$binPath/HomeManagerStatus" "$APP/Contents/MacOS/HomeManagerStatus" 42 - cp ${./Info.plist} "$APP/Contents/Info.plist" 42 + cp ${./../Info.plist} "$APP/Contents/Info.plist" 43 43 44 44 runHook postInstall 45 45 '';