Skip to content

Comprehensive nix-Darwin support assessment and implementation roadmap - #3

Draft
Jyumpp with Copilot wants to merge 5 commits into
mainfrom
copilot/refactor-nix-darwin-support
Draft

Comprehensive nix-Darwin support assessment and implementation roadmap#3
Jyumpp with Copilot wants to merge 5 commits into
mainfrom
copilot/refactor-nix-darwin-support

Conversation

Copilot AI commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

Provides production-ready technical assessment for extending nixos-systems to support nix-Darwin configurations alongside existing NixOS infrastructure.

Problem Statement

User asked: "Without doing it, how much work would it take to refactor to also support nix-Darwin configurations?"

Deliverables

Main Assessment (DARWIN_SUPPORT_ASSESSMENT.md)

20+ page technical analysis covering:

  • Architecture readiness: modular design, flexible inventory, unified user management already compatible
  • Component breakdown: 10 major components with specific changes, effort estimates, code examples
  • Migration strategy: 5-phase plan (Foundation → Software Profiles → Integration → Documentation → Validation)
  • Timeline: 2-3 weeks (41-62 hours dev + 24-38 hours testing)

Supporting Documentation

  • docs/DARWIN_QUICK_REFERENCE.md - TL;DR with implementation checklist
  • docs/darwin-architecture.md - Visual architecture diagrams (current vs proposed)
  • docs/IMPLEMENTATION_SUMMARY.md - Executive summary

Example Implementations (docs/darwin-examples/)

Complete working examples demonstrating:

# Platform-aware service configuration
lib.mkMerge [
  (lib.mkIf pkgs.stdenv.isLinux {
    systemd.services.updater = { ... };
  })
  (lib.mkIf pkgs.stdenv.isDarwin {
    launchd.agents.updater = { ... };
  })
]

Key examples:

  • Darwin host types with macOS system defaults
  • Platform-conditional service management (systemd vs launchd)
  • Mixed Linux/Darwin inventory configuration

Key Technical Changes Required

  1. Host Generation (1-2 days) - Refactor hosts/default.nix:

    • Add platform dispatcher: if darwin then mkDarwinHost else mkNixOSHost
    • Split outputs: nixosConfigurations + darwinConfigurations
  2. Module Structure (2-3 hours) - Separate platform-specific config:

    • Rename common.nixlinux-common.nix (boot, disko, systemd)
    • Create darwin-common.nix (system.defaults, launchd, no boot config)
  3. Software Profiles (1-2 days) - Platform detection in sw/:

    • Conditional package lists: lib.optionals stdenv.isLinux [kde...]
    • Service translation: systemd.services.* → launchd.agents.*
  4. Host Types (1 day) - Create hosts/types/darwin-*.nix:

    • macOS system defaults instead of kernel params
    • No disko/bootloader configuration

Architecture Assessment

Feasibility: ✅ Recommended - existing structure well-suited for extension

Risk: Low - changes are additive and isolated, no breaking changes to NixOS configs

Complexity: Medium-high due to systemd→launchd translation and dual-platform testing requirements

Updated

  • README.md: Added "Future Enhancements" section with Darwin support overview
Original prompt

Without doing it, how much work would it take to refactor to also support nix-Darwin configurations?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits December 17, 2025 13:22
Co-authored-by: Jyumpp <11142390+Jyumpp@users.noreply.github.com>
Co-authored-by: Jyumpp <11142390+Jyumpp@users.noreply.github.com>
Co-authored-by: Jyumpp <11142390+Jyumpp@users.noreply.github.com>
Co-authored-by: Jyumpp <11142390+Jyumpp@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor to support nix-Darwin configurations Comprehensive nix-Darwin support assessment and implementation roadmap Dec 17, 2025
Copilot AI requested a review from Jyumpp December 17, 2025 13:29
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