···2020 system.primaryUser = cfg.user.username;
21212222 myConfig.isDesktop = true;
2323+ myConfig.forgejo.userApiTokenFile = "/Users/${config.myConfig.user.username}/.config/forgejo-user-token";
23242425 networking = {
2526 hostName = "macmini";
2627 computerName = "MacMini";
2728 };
2828-29293030 # ── External disk (CT2000X9SSD9, APFS container on disk4s2) ───────────────
3131 # See docs/time-machine.md for first-time setup instructions.
···3434 # Tailscale — auto-start at login so SSH ProxyCommand never fails on boot.
3535 launchd.user.agents."com.tailscale.tailscaled-launcher" = {
3636 serviceConfig = {
3737- ProgramArguments = [ "/usr/bin/open" "-a" "/Applications/Tailscale.app" ];
3737+ ProgramArguments = [
3838+ "/usr/bin/open"
3939+ "-a"
4040+ "/Applications/Tailscale.app"
4141+ ];
3842 RunAtLoad = true;
3943 KeepAlive = false;
4044 };
···4549 # Launch it automatically at login via a launchd user agent instead.
4650 launchd.user.agents."com.rileytestut.AltServer-launcher" = {
4751 serviceConfig = {
4848- ProgramArguments = [ "/usr/bin/open" "-a" "/Applications/AltServer.app" ];
5252+ ProgramArguments = [
5353+ "/usr/bin/open"
5454+ "-a"
5555+ "/Applications/AltServer.app"
5656+ ];
4957 RunAtLoad = true;
5050- KeepAlive = false; # one-shot: open the app then exit
5858+ KeepAlive = false; # one-shot: open the app then exit
5159 };
5260 };
5361
+11-54
modules/darwin/common.nix
···22{
33 config,
44 lib,
55- pkgs,
65 ...
76}:
87let
···1110{
1211 programs.zsh.enable = true;
13121414- nix = {
1515- # Explicit nix management via nix-darwin.
1616- # NOTE: Set `nix.enable = false` if you use Determinate Nix, which manages
1717- # the nix daemon itself and conflicts with nix-darwin's native management.
1818- enable = true;
1919- package = pkgs.nix;
2020-2121- settings = {
2222- experimental-features = [
2323- "nix-command"
2424- "flakes"
2525- ];
2626-2727- # IMPORTANT: Disable store optimisation on macOS.
2828- # `auto-optimise-store = true` triggers a kernel bug on macOS that causes
2929- # build failures: https://github.com/NixOS/nix/issues/7273
3030- # Use `nix store optimise` manually when needed instead.
3131- auto-optimise-store = false;
3232-3333- # Allow the primary user to use trusted nix operations (e.g. adding
3434- # substituters) without requiring root.
3535- trusted-users = [
3636- "root"
3737- cfg.user.username
3838- ];
3939-4040- # Storage pressure management — keep the Nix store from ballooning on
4141- # a 256 GB disk. Nix will trigger GC automatically when free space on
4242- # the store volume drops below min-free, stopping once max-free is reached.
4343- # Values are in bytes: 5 GiB min-free, 10 GiB max-free.
4444- min-free = 5368709120; # 5 GiB
4545- max-free = 10737418240; # 10 GiB
4646-4747- # Do not retain build-time inputs or derivations after a successful build.
4848- # These are only needed for `nix develop` / `nix-shell` workflows; keeping
4949- # them on a space-constrained machine is not worth it.
5050- keep-outputs = false;
5151- keep-derivations = false;
5252- };
5353-5454- # Automatic garbage collection (macOS launchd schedule)
5555- gc = {
5656- automatic = true;
5757- interval = {
5858- Weekday = 0;
5959- Hour = 2;
6060- Minute = 0;
6161- }; # Every Sunday at 02:00
6262- # Keep only the last 14 days of generations on the space-constrained
6363- # 256 GB Mac. Linux hosts retain 30 days (set in modules/common.nix).
6464- options = "--delete-older-than 14d";
6565- };
6666- };
1313+ # NOTE: Set `nix.enable = false` if you use Determinate Nix, which manages
1414+ # the nix daemon itself and conflicts with nix-darwin's native management.
1515+ nix.enable = false;
67166817 # NOTE: system.autoUpgrade does not exist in nix-darwin.
6918 # Run manually: darwin-rebuild switch --flake ~/.config/nix-config#macmini
···7221 # nix-darwin only executes hardcoded script names, so we append to postActivation
7322 # rather than using a custom name (which would be silently ignored).
7423 system.activationScripts.postActivation.text = lib.mkAfter ''
2424+ # Clean up stale nix-darwin launchd services left over from nix.enable = true.
2525+ for svc in org.nixos.nix-daemon org.nixos.nix-gc; do
2626+ if /bin/launchctl list "$svc" &>/dev/null; then
2727+ /bin/launchctl bootout system "$svc" 2>/dev/null || true
2828+ echo "postActivation: booted out stale service $svc"
2929+ fi
3030+ done
3131+7532 REPO="/Users/${cfg.user.username}/.config/nix-config"
7633 if [ -d "$REPO/.git" ]; then
7734 ln -sf "$REPO/hooks/pre-commit" "$REPO/.git/hooks/pre-commit"
+10
modules/options.nix
···3131 type = str;
3232 default = "ewan";
3333 };
3434+ githubUsername = mkOption {
3535+ type = str;
3636+ default = "ewanc26";
3737+ description = "GitHub username for cloning repos into ~/Developer/Git.";
3838+ };
3439 fullName = mkOption {
3540 type = str;
3641 default = "Ewan Croft";
···475480 disableRegistration = mkOption {
476481 type = bool;
477482 default = true;
483483+ };
484484+ userApiTokenFile = mkOption {
485485+ type = nullStr;
486486+ default = null;
487487+ description = "Path to a file containing a Forgejo user API token. Used to list private repos for ~/Developer/Local.";
478488 };
479489 };
480490