diff --git a/crates/omnix-cli/src/command/show.rs b/crates/omnix-cli/src/command/show.rs index 8fa30ef0..c8e326d4 100644 --- a/crates/omnix-cli/src/command/show.rs +++ b/crates/omnix-cli/src/command/show.rs @@ -146,6 +146,14 @@ impl ShowCommand { self.flake_url )), ); + print_flake_output_table( + "🔄 Process Compose", + &["allSystems", system.as_ref()], + Some(format!( + "nix run {}#", + self.flake_url + )), + ); print_flake_output_table("🔧 NixOS Modules", &["nixosModules"], None); print_flake_output_table( "🐳 Docker Images", diff --git a/nix/flake-schemas/flake.lock b/nix/flake-schemas/flake.lock index 2e259ccb..f19b0461 100644 --- a/nix/flake-schemas/flake.lock +++ b/nix/flake-schemas/flake.lock @@ -17,7 +17,23 @@ }, "root": { "inputs": { - "flake-schemas": "flake-schemas" + "flake-schemas": "flake-schemas", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/nix/flake-schemas/flake.nix b/nix/flake-schemas/flake.nix index 988ef455..fd63445a 100644 --- a/nix/flake-schemas/flake.nix +++ b/nix/flake-schemas/flake.nix @@ -1,8 +1,9 @@ { inputs = { flake-schemas.url = "github:DeterminateSystems/flake-schemas"; + systems.url = "github:nix-systems/default"; }; - outputs = { flake-schemas, ... }: + outputs = inputs@{ flake-schemas, ... }: let appsSchema = { version = 1; @@ -79,6 +80,32 @@ }) output); }; + processComposeSchema = { + # Enabling flake-parts `debug` flag is required for this schema to work. + # https://flake.parts/options/flake-parts.html#opt-debug + # TODO: https://github.com/Platonic-Systems/process-compose-flake should provide schema for it self + # So that omnix at runtime can fetch and merge the schema from the flake + version = 1; + doc = '' + The `apps` output provides commands available via `nix run`. + ''; + inventory = output: + flake-schemas.lib.mkChildren (builtins.listToAttrs (map + (system: { + name = system; + value = flake-schemas.lib.mkChildren (builtins.mapAttrs + (processes: definition: + { + evalChecks.isValidProcess = + definition ? settings; + what = "Process Compose"; + evalOnAllSystems = true; + }) + (output.${system}.process-compose or { })); + }) + (import inputs.systems))); + }; + in { schemas = flake-schemas.schemas // { @@ -87,6 +114,7 @@ nixosConfigurations = nixosConfigurationsSchema; homeConfigurations = homeConfigurationsSchema; darwinConfigurations = darwinConfigurationsSchema; + allSystems = processComposeSchema; }; }; }