Skip to content

Restructure JSON output to organize by system and fix byName collisions #39

@srid

Description

@srid

Currently, the JSON output produced by devour-flake has two issues:

  1. Name collisions in byName index: When building for multiple systems (via --override-input systems), packages with the same name from different systems overwrite each other in the byName mapping. Only the last system's package survives.

  2. Flat structure lacks system organization: The current output doesn't clearly separate which outputs belong to which system, making it difficult to consume the data programmatically.

Current JSON structure:

{
  "outPaths": [...],
  "byName": {
    "hello": "/nix/store/...-hello-aarch64"  // x86_64 version was lost!
  }
}

Proposed JSON structure:

{
  "x86_64-linux": {
    "outPaths": [...],
    "byName": {
      "hello": "/nix/store/...-hello-x86_64",
      "firefox": "/nix/store/...-firefox-123"
    }
  },
  "aarch64-linux": {
    "outPaths": [...],
    "byName": {
      "hello": "/nix/store/...-hello-aarch64",
      "firefox": "/nix/store/...-firefox-123"
    }
  }
}

Benefits:

  • No more name collisions - each system has its own byName namespace
  • Clear system organization makes it easier to process outputs programmatically
  • Sorted outPaths within each system for predictable ordering
  • The text output (default) remains unchanged, continuing to list all paths across all systems

Additional improvements:

  • Sort outPaths lexicographically for consistent output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions