Skip to content

Fix macOS compatibility: move Linux-only packages to conditional section in emu flake - #5

Draft
anicolao with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-3040e117-6a08-4f2c-ae2c-ae87eb3905ae
Draft

Fix macOS compatibility: move Linux-only packages to conditional section in emu flake#5
anicolao with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-3040e117-6a08-4f2c-ae2c-ae87eb3905ae

Conversation

Copilot AI commented Aug 22, 2025

Copy link
Copy Markdown
Contributor

Fixes an issue where nix develop would fail on macOS with an error about parted not being available on arm64-apple-darwin.

Problem

The emu/flake.nix was unconditionally including parted and util-linux packages in the development shell, but these are Linux-only packages that don't exist on macOS platforms. This caused nix develop to fail with:

error: Package 'parted-3.6' in /nix/store/.../pkgs/by-name/pa/parted/package.nix:75 is not available on the requested hostPlatform:
  hostPlatform.config = "arm64-apple-darwin"
  package.meta.platforms = [
    "aarch64-linux"
    "armv5tel-linux"
    ...
  ]

Solution

Moved pkgs.parted and pkgs.util-linux from the unconditional packages list to the Linux-only conditional section, since:

  1. The launch-pi.sh script already has platform-specific image mounting logic:

    • Linux: Uses losetup, mount, kpartx, and parted for loop device manipulation
    • macOS: Uses hdiutil for disk image operations
  2. These tools are only needed for Linux-based image manipulation workflows

Changes

  • Moved parted and util-linux to the pkgs.lib.optionals pkgs.stdenv.isLinux section
  • Updated shell hook message to indicate parted is Linux-only
  • Preserved all existing functionality and cross-platform compatibility

Now nix develop works on both Linux and macOS without requiring workarounds or environment variables.


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

…kages

Co-authored-by: anicolao <1145048+anicolao@users.noreply.github.com>
Copilot AI changed the title [WIP] When I run nix-develop on darwin, it complains about installing parted for linux, which ought not to be necessary. Fix the implementation not to require workarounds on macos. ``` $ nix develop warning: creating lock file '"/Users/anicolao/projects/nixo... Fix macOS compatibility: move Linux-only packages to conditional section in emu flake Aug 22, 2025
Copilot AI requested a review from anicolao August 22, 2025 03:50
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