Add default-instance check

- validate implicit default instance wires systemd unit name
- run new check in garnix

Tests: not run (not requested)
This commit is contained in:
DJTBOT 2026-02-04 11:05:16 -08:00
parent 90d5c0b2c6
commit 48b5bee635
3 changed files with 88 additions and 0 deletions

View File

@ -61,6 +61,7 @@
config-options = pkgs.callPackage ./nix/checks/openclaw-config-options.nix {
sourceInfo = sourceInfoStable;
};
default-instance = pkgs.callPackage ./nix/checks/openclaw-default-instance.nix {};
hm-activation = import ./nix/checks/openclaw-hm-activation.nix {
inherit pkgs home-manager;
};

View File

@ -11,5 +11,6 @@ builds:
- "checks.x86_64-linux.gateway"
- "checks.x86_64-linux.gateway-tests"
- "checks.x86_64-linux.config-options"
- "checks.x86_64-linux.default-instance"
- "checks.x86_64-linux.config-validity"
- "checks.x86_64-linux.package-contents"

View File

@ -0,0 +1,86 @@
{ lib, pkgs, stdenv }:
let
stubModule = { lib, ... }: {
options = {
assertions = lib.mkOption {
type = lib.types.listOf lib.types.attrs;
default = [];
};
home.homeDirectory = lib.mkOption {
type = lib.types.str;
default = "/tmp";
};
home.packages = lib.mkOption {
type = lib.types.listOf lib.types.anything;
default = [];
};
home.file = lib.mkOption {
type = lib.types.attrs;
default = {};
};
home.activation = lib.mkOption {
type = lib.types.attrs;
default = {};
};
launchd.agents = lib.mkOption {
type = lib.types.attrs;
default = {};
};
systemd.user.services = lib.mkOption {
type = lib.types.attrs;
default = {};
};
programs.git.enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
lib = lib.mkOption {
type = lib.types.attrs;
default = {};
};
};
};
eval = lib.evalModules {
modules = [
stubModule
../modules/home-manager/openclaw.nix
({ lib, ... }: {
config = {
home.homeDirectory = "/tmp";
programs.git.enable = false;
lib.file.mkOutOfStoreSymlink = path: path;
programs.openclaw = {
enable = true;
launchd.enable = false;
systemd.enable = true;
};
};
})
];
specialArgs = { inherit pkgs; };
};
hasUnit = builtins.hasAttr "openclaw-gateway" eval.config.systemd.user.services;
check = if hasUnit then "ok" else throw "Default Openclaw instance missing systemd.unitName.";
checkKey = builtins.deepSeq check "ok";
in
stdenv.mkDerivation {
pname = "openclaw-default-instance";
version = "1";
dontUnpack = true;
env = {
OPENCLAW_DEFAULT_INSTANCE = checkKey;
};
installPhase = "${../scripts/empty-install.sh}";
}