From 30002b7ded23cb6dca06ba087a5fed62e65d0b34 Mon Sep 17 00:00:00 2001 From: joshp123 Date: Fri, 8 May 2026 13:37:09 +0800 Subject: [PATCH] test: cover default OpenClaw instance on Darwin Move the default-instance check into the common check set so Darwin evaluates the plugin/config generation path too. Keep the Linux systemd assertion and add the Darwin launchd assertion for the Home Manager module. Tests: - nix build --accept-flake-config .#checks.aarch64-darwin.default-instance .#checks.aarch64-darwin.package-contents .#checks.aarch64-darwin.config-validity --no-link --option narinfo-cache-negative-ttl 0 - nix build --accept-flake-config .#checks.x86_64-linux.default-instance --no-link --option narinfo-cache-negative-ttl 0 - nix build --accept-flake-config .#checks.aarch64-darwin.ci --no-link --option narinfo-cache-negative-ttl 0 - nix build --impure --accept-flake-config .#darwinConfigurations.mac-mini.system --no-link --override-input nix-openclaw path:/Users/josh/code/nix/nix-openclaw --option narinfo-cache-negative-ttl 0 Co-authored-by: Codex --- flake.nix | 2 +- nix/checks/openclaw-default-instance.nix | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 0a9b86f..2796168 100644 --- a/flake.nix +++ b/flake.nix @@ -96,6 +96,7 @@ package-contents = pkgs.callPackage ./nix/checks/openclaw-package-contents.nix { openclawGateway = packageSetStable.openclaw-gateway; }; + default-instance = pkgs.callPackage ./nix/checks/openclaw-default-instance.nix { }; config-validity = pkgs.callPackage ./nix/checks/openclaw-config-validity.nix { openclawGateway = packageSetStable.openclaw-gateway; }; @@ -120,7 +121,6 @@ { config-options = sourceChecks; source-checks = sourceChecks; - default-instance = pkgs.callPackage ./nix/checks/openclaw-default-instance.nix { }; hm-activation = import ./nix/checks/openclaw-hm-activation.nix { inherit pkgs home-manager; }; diff --git a/nix/checks/openclaw-default-instance.nix b/nix/checks/openclaw-default-instance.nix index ad62a83..5b08f06 100644 --- a/nix/checks/openclaw-default-instance.nix +++ b/nix/checks/openclaw-default-instance.nix @@ -103,8 +103,8 @@ let lib.file.mkOutOfStoreSymlink = path: path; programs.openclaw = { enable = true; - launchd.enable = false; - systemd.enable = true; + launchd.enable = pkgs.stdenv.hostPlatform.isDarwin; + systemd.enable = pkgs.stdenv.hostPlatform.isLinux; } // openclawConfig; }; @@ -135,10 +135,13 @@ let defaultEval = moduleEval { }; defaultConfig = builtins.fromJSON defaultEval.config.home.file.".openclaw/openclaw.json".text; - hasUnit = builtins.hasAttr "openclaw-gateway" defaultEval.config.systemd.user.services; + hasLinuxUnit = builtins.hasAttr "openclaw-gateway" defaultEval.config.systemd.user.services; + hasDarwinAgent = builtins.hasAttr "com.steipete.openclaw.gateway" defaultEval.config.launchd.agents; defaultCheck = builtins.deepSeq (requireNoAssertionFailures "default instance" defaultEval) ( - if !hasUnit then + if pkgs.stdenv.hostPlatform.isLinux && !hasLinuxUnit then throw "Default OpenClaw instance missing systemd.unitName." + else if pkgs.stdenv.hostPlatform.isDarwin && !hasDarwinAgent then + throw "Default OpenClaw instance missing launchd.label." else if (((defaultConfig.gateway or { }).mode or null) != "local") then throw "Default OpenClaw instance missing gateway.mode." else