Skip to content

feat(makefile): add platform-specific service restart commands - #418

Merged
shunkakinoki merged 1 commit into
mainfrom
platform-specific-make
Dec 14, 2025
Merged

feat(makefile): add platform-specific service restart commands#418
shunkakinoki merged 1 commit into
mainfrom
platform-specific-make

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Dec 13, 2025

Copy link
Copy Markdown
Owner

Summary

  • Add new services target that detects OS and calls appropriate service manager
  • launchctl targets now only run on macOS (via the services target)
  • Add systemctl targets for Linux (code-syncer, dotfiles-updater, ollama)
  • Update switch target to use platform-aware services target

Test plan

  • Verify make switch works correctly on macOS (calls launchctl targets)
  • Verify make switch works correctly on Linux (calls systemctl targets)
  • Verify individual make systemctl-* targets work on Linux

🤖 Generated with Claude Code


Summary by cubic

Adds a platform-aware services target so make switch restarts the right user services on each OS. On macOS it uses launchctl; on Linux it uses systemd user units.

  • New Features
    • Added services target that detects OS and routes to launchctl (macOS) or systemctl (Linux).
    • Added systemctl targets for code-syncer, dotfiles-updater, and ollama, plus a systemctl aggregate target.
    • Updated switch to call services; launchctl restarts now run only on macOS.

Written for commit ef6fa03. Summary will update automatically on new commits.

- Add new `services` target that detects OS and calls appropriate service manager
- launchctl targets now only run on macOS
- Add systemctl targets for Linux (code-syncer, dotfiles-updater, ollama)
- Update `switch` target to use platform-aware `services` target

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 13, 2025 23:39
@coderabbitai

coderabbitai Bot commented Dec 13, 2025

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features
    • Added new services target for platform-aware service management, automatically using launchctl on macOS and systemctl on Linux.
    • Added individual service control targets to restart code-syncer, dotfiles-updater, and ollama services independently.
    • Updated switch target to leverage the new service-oriented restart path for improved cross-platform compatibility.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

The Makefile has been refactored to introduce a platform-agnostic service management abstraction. The switch target now delegates to a new services target, which routes to platform-specific commands: launchctl on macOS and systemctl on Linux. Five new systemd-related targets enable independent management of individual Linux services.

Changes

Cohort / File(s) Summary
Platform-aware service abstraction
Makefile
Modified switch target to depend on nix-switch services instead of nix-switch launchctl; added new services phony target that branches to launchctl or systemctl based on platform.
Linux systemd service targets
Makefile
Added systemctl phony target to restart all user services (code-syncer, dotfiles-updater, ollama); added individual targets systemctl-code-syncer, systemctl-dotfiles-updater, and systemctl-ollama for granular service control.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Single-file change with straightforward target additions
  • No complex logic; consists of command definitions following a consistent, repetitive pattern
  • Clear intent: platform abstraction via conditional execution

Poem

🐰 A rabbit hops 'cross systems twain,
Where launchctl meets systemd's domain,
New targets sprout like carrots bright,
Services dance left, then right—
Cross-platform harmony in sight! 🌱

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding platform-specific service restart commands to the Makefile.
Description check ✅ Passed The description is well-related to the changeset, providing clear details about the new services target, platform detection, and OS-specific commands being added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch platform-specific-make

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 341e6cd and ef6fa03.

📒 Files selected for processing (1)
  • Makefile (2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/services/**/*.nix : Service configurations in `home-manager/services/` should follow systemd service conventions, include proper service dependencies, and have clear documentation for service parameters
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/services/**/*.nix : Service configurations in `home-manager/services/` should follow systemd service conventions, include proper service dependencies, and have clear documentation for service parameters

Applied to files:

  • Makefile
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Document all major changes in Nix configurations

Applied to files:

  • Makefile
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Test Nix and home-manager configurations locally before pushing using `make test`

Applied to files:

  • Makefile
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: Agent
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
  • GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)
  • GitHub Check: nix-linux
  • GitHub Check: lua-neovim
  • GitHub Check: lua-neovim-test
  • GitHub Check: nix-nixos
  • GitHub Check: lua-hammerspoon
  • GitHub Check: shellspec
  • GitHub Check: shellcheck
🔇 Additional comments (3)
Makefile (3)

144-145: switch target correctly chains Nix configuration with platform-aware service restart.

The modification cleanly delegates service management to the new abstraction layer while preserving the existing build-and-activate flow.


147-153: services target provides clean OS-level abstraction for service management.

Platform routing is clear and reuses existing launchctl and new systemctl targets appropriately. The approach is sound and maintainable.


641-662: No changes needed. The systemd services referenced in the Makefile (code-syncer.service, dotfiles-updater.service, and ollama.service) are properly defined in your home-manager configuration. All three have corresponding systemd.user.services definitions in home-manager/services/ with correct naming that matches the Makefile targets.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Makefile's cross-platform compatibility by introducing a new services target that intelligently handles service restarts based on the operating system. It integrates systemd support for Linux services while consolidating launchctl calls for macOS, streamlining the make switch command to provide a unified experience for applying Nix configurations and restarting relevant services across different environments.

Highlights

  • Platform-aware Service Management: Introduced a new services target in the Makefile that dynamically detects the operating system (macOS or Linux) and invokes the appropriate service manager (launchctl or systemctl).
  • Linux Systemd Support: Added dedicated systemctl targets for Linux, enabling the restart of code-syncer, dotfiles-updater, and ollama user services via systemctl.
  • Unified Service Restart: The switch target has been updated to utilize the new services target, ensuring a consistent and platform-agnostic way to restart services after applying Nix configurations.
  • macOS launchctl Integration: Existing launchctl targets are now exclusively called through the services target when running on macOS, centralizing service management logic.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mesa-dot-dev

mesa-dot-dev Bot commented Dec 13, 2025

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@mesa-dot-dev

mesa-dot-dev Bot commented Dec 13, 2025

Copy link
Copy Markdown

Mesa Description

TL;DR

Added a new services target to the Makefile that detects the operating system and calls the appropriate service manager (launchctl for macOS, systemctl for Linux). This centralizes service restart commands and updates the switch target to be platform-aware.

What changed?

  • Added new services target that detects OS and calls appropriate service manager
  • launchctl targets now only run on macOS (via the services target)
  • Added systemctl targets for Linux (code-syncer, dotfiles-updater, ollama)
  • Updated switch target to use platform-aware services target

Description generated by Mesa. Update settings

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a great step towards unifying the service management across different operating systems by introducing a platform-aware services target. The implementation is mostly correct, but I've found a critical issue where a macOS-only service is targeted on Linux, which would cause failures. I've also suggested adding a few missing Linux services for consistency with the macOS implementation and improving the handling of unsupported operating systems. With these corrections, the changes will be robust and work as intended.

Comment thread Makefile
Comment on lines +644 to +662
systemctl: systemctl-code-syncer systemctl-dotfiles-updater systemctl-ollama ## Restart all systemd user services.

.PHONY: systemctl-code-syncer
systemctl-code-syncer: ## Restart code-syncer systemd user service.
@echo "🔄 Restarting code-syncer..."
@systemctl --user restart code-syncer.service || true
@echo "✅ code-syncer restarted"

.PHONY: systemctl-dotfiles-updater
systemctl-dotfiles-updater: ## Restart dotfiles-updater systemd user service.
@echo "🔄 Restarting dotfiles-updater..."
@systemctl --user restart dotfiles-updater.service || true
@echo "✅ dotfiles-updater restarted"

.PHONY: systemctl-ollama
systemctl-ollama: ## Restart ollama systemd user service.
@echo "🔄 Restarting ollama..."
@systemctl --user restart ollama.service || true
@echo "✅ ollama restarted"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The new systemctl targets have some inconsistencies with the available services defined in the Nix configurations.

  1. Incorrect Service: The code-syncer service is macOS-only, so the systemctl-code-syncer target will fail on Linux and should be removed.
  2. Missing Services: The cliproxyapi and neverssl-keepalive services have Linux implementations but are missing corresponding systemctl-* targets and are not included in the main systemctl aggregate target.

To fix this and align with the launchctl targets, the systemctl targets should be updated. I've also sorted them alphabetically for better readability.

systemctl: systemctl-cliproxyapi systemctl-dotfiles-updater systemctl-neverssl-keepalive systemctl-ollama ## Restart all systemd user services.

.PHONY: systemctl-cliproxyapi
systemctl-cliproxyapi: ## Restart cliproxyapi systemd user service.
	@echo "🔄 Restarting cliproxyapi..."
	@systemctl --user restart cliproxyapi.service || true
	@echo "✅ cliproxyapi restarted"

.PHONY: systemctl-dotfiles-updater
systemctl-dotfiles-updater: ## Restart dotfiles-updater systemd user service.
	@echo "🔄 Restarting dotfiles-updater..."
	@systemctl --user restart dotfiles-updater.service || true
	@echo "✅ dotfiles-updater restarted"

.PHONY: systemctl-neverssl-keepalive
systemctl-neverssl-keepalive: ## Restart neverssl-keepalive systemd user service.
	@echo "🔄 Restarting neverssl-keepalive..."
	@systemctl --user restart neverssl-keepalive.service || true
	@echo "✅ neverssl-keepalive restarted"

.PHONY: systemctl-ollama
systemctl-ollama: ## Restart ollama systemd user service.
	@echo "🔄 Restarting ollama..."
	@systemctl --user restart ollama.service || true
	@echo "✅ ollama restarted"

Comment thread Makefile
Comment on lines +149 to +153
@if [ "$(OS)" = "Darwin" ]; then \
$(MAKE) launchctl; \
elif [ "$(OS)" = "Linux" ]; then \
$(MAKE) systemctl; \
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's good practice to handle the case where $(OS) is neither "Darwin" nor "Linux". Adding an else clause to the conditional would provide clearer feedback to users on unsupported operating systems, preventing silent failures or confusion.

	@if [ "$(OS)" = "Darwin" ]; then \
		$(MAKE) launchctl; \
	elif [ "$(OS)" = "Linux" ]; then \
		$(MAKE) systemctl; \
	else \
		echo "No platform-specific services to restart for OS $(OS)"; \
	fi

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds platform-specific service restart commands to the Makefile, enabling cross-platform support for managing system services. The switch target now automatically detects the operating system (macOS or Linux) and calls the appropriate service manager (launchctl or systemd).

Key Changes

  • Introduced a new services target that performs OS detection and delegates to platform-specific targets
  • Added systemctl targets for Linux to restart user services (code-syncer, dotfiles-updater, ollama)
  • Updated the switch target to use the platform-aware services target instead of directly calling launchctl

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
##@ Systemd Services (Linux)

.PHONY: systemctl
systemctl: systemctl-code-syncer systemctl-dotfiles-updater systemctl-ollama ## Restart all systemd user services.

Copilot AI Dec 13, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The systemctl target only restarts 3 services (code-syncer, dotfiles-updater, ollama) while the launchctl target restarts 6 services (brew-upgrader, cliproxyapi, code-syncer, dotfiles-updater, neverssl-keepalive, ollama). This creates platform inconsistency where macOS users get more services restarted than Linux users when running 'make switch'. Either add the missing systemctl targets for brew-upgrader, cliproxyapi, and neverssl-keepalive, or document why these services are macOS-only.

Copilot uses AI. Check for mistakes.
@shunkakinoki
shunkakinoki enabled auto-merge (squash) December 13, 2025 23:52
@shunkakinoki
shunkakinoki merged commit 9a11d47 into main Dec 14, 2025
38 checks passed
@shunkakinoki
shunkakinoki deleted the platform-specific-make branch December 14, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants