This project provides a Nix package and NixOS module for the Quest KACE AMP Agent, specifically designed for the generic Linux tarball distribution.
- Module:
modules/services/kace-ampagent.nix - Package:
pkgs/kace-ampagent/default.nix
The kace-ampagent Nix package requires the official generic Linux agent tarball (e.g., ampagent-15.0.54.ubuntu.64.tar.gz). This file is not included in the repository due to licensing and distribution restrictions.
You must provide this file yourself. The pkgs/kace-ampagent/default.nix uses requireFile to locate it based on its filename and SHA256 hash.
Follow these steps to make the tarball available to Nix:
-
Download the Agent Tarball: Obtain the
ampagent-<version>.ubuntu.64.tar.gzfile from your KACE SMA portal. The exact filename and version are specified withinpkgs/kace-ampagent/default.nix. -
Verify SHA256 Hash (Recommended): The
default.nixfile contains a specific SHA256 hash for the expected tarball. If your downloaded file has a different hash, the build will fail. You can compute the hash of your file using:nix hash-file --type sha256 ampagent-<version>.ubuntu.64.tar.gz
If the computed hash differs from the one in
pkgs/kace-ampagent/default.nix, you will need to update thesha256attribute in that file to match your downloaded tarball. -
Make the Tarball Accessible to Nix: Add the file directly to your Nix store using the
nix store add-filecommand. This registers the file with Nix, allowingrequireFileto find it by its content hash:nix store add-file ./ampagent-<version>.ubuntu.64.tar.gz
(Ensure you are in the directory containing the tarball when running this command.)
Once the tarball is correctly added to the store, Nix will be able to find it during the build process.
- Add this flake as an input in your system flake (e.g.
flake.nix):
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; # or your channel
kace-ampagent.url = "github:kd2flz/kace-ampagent/main"; # or your fork/branch
};- Import the NixOS module in your system configuration. The module brings in the service and registers an overlay so
pkgs.kace-ampagentis built with your system's nixpkgs:
# In configuration.nix or wherever you list modules:
imports = [ kace-ampagent.nixosModules.kace-ampagent ];- Enable and configure the agent (see Module Options below). Do not set
services.kace-ampagent.packageunless you have a specific reason: the default package comes from the overlay and is built with the same nixpkgs as the rest of your system, which avoids glibc mismatches and keeps your config independent ofinputs.kace-ampagentin scope.
services.kace-ampagent = {
enable = true;
host = "kbox.example.com";
# ampConf = { ... }; # optional
};You do not need to reference kace-ampagent in your flake outputs or specialArgs; the module is self-contained once imported.
To build the package or test the flake locally (after providing the tarball as described above):
nix build .#kace-ampagentservices.kace-ampagent.enable: Enable the KACE AMP Agent (boolean, defaultfalse). When enabled, the following systemd services are started:kace-ampagent-initial-config: One-time service that runskonea -urlandkonea -enableto enroll the agent with the serverkace-ampagent-setup: Creates theamp.confconfiguration file with the host and optional settingskonea: Main KACE agent service that runskonea -startas a daemonkschedulerconsole: Scheduler console service that starts after koneaampwatchdog(optional): Standalone watchdog service whenenableWatchdog = true
services.kace-ampagent.package: The Nix package providing the KACE agent binaries (package, default:pkgs.kace-ampagentfrom the overlay). Leave unset so the module builds the package with your system's nixpkgs; override only if you need a different source.services.kace-ampagent.dataDir: The directory where the agent stores its data (string, default/var/quest/kace).services.kace-ampagent.logDir: The directory where the agent stores its logs (string, default/var/log/quest/kace).services.kace-ampagent.environment: An attribute set of extra environment variables for the agent (attrset, default{}).services.kace-ampagent.linkOptPath: Create a/opt/quest/kacesymlink pointing to the package content for compatibility (boolean, defaulttrue).services.kace-ampagent.host: The KACE SMA host (string, required). Written toamp.confashost=.services.kace-ampagent.ampConf: An attribute set of additional key-value pairs foramp.conf(attrset, default{}).services.kace-ampagent.enableWatchdog: Enable the standaloneAMPWatchDogservice (boolean, defaultfalse).
services.kace-ampagent = {
enable = true;
host = "kbox.example.com"; # Replace with your KACE SMA host
ampConf = {
# Example additional amp.conf settings
org = "Default";
# Other settings like CERT_VALIDATION, etc.
};
enableWatchdog = true; # Optional: enables AMPWatchDog service
};When the module is enabled, the following systemd services are created and run in order:
-
kace-ampagent-setup.service(oneshot): Creates/var/quest/kace/amp.confwithhost=and anyampConfentries -
kace-ampagent-initial-config.service(oneshot): Runs once to enroll the agent:- Runs
konea -url <host>to configure the server URL - Runs
konea -enableto enroll the agent and download kbot scripts - Creates
/var/quest/kace/.initial-config-donemarker file to prevent re-running
- Runs
-
konea.service(simple): Runskonea -startas a daemon to connect to the KACE SMA -
kschedulerconsole.service(simple): RunsKSchedulerConsole(depends on konea) -
ampwatchdog.service(simple, optional): RunsAMPWatchDogwhenenableWatchdog = true -
konea-checker.timerandkonea-checker.service(optional): Periodic health checks whenenableWatchdog = true
When running konea commands manually (outside of systemd):
-
Ensure the package is built and available:
nix build .#kace-ampagent -
Run the binaries from the package:
./result/opt/quest/kace/bin/konea -help
-
Available
koneacommands:konea -start- Start the konea daemonkonea -stop- Stop the konea daemonkonea -url <host>- Set the server URLkonea -enable- Enable connection to the server (enrollment)konea -disable- Disable connection to server (daemon still runs)konea -version- Output version information
-
Running kbot scripts manually:
./result/opt/quest/kace/bin/runkbot <kbot-id> <version>
-
The KACE agent expects its files under
/opt/quest/kace. The module creates a symlink to the package content at/opt/quest/kaceby default (services.kace-ampagent.linkOptPath = true;). -
Initial enrollment is automatic: When you first enable the module,
konea -enableruns automatically during the initial configuration. This enrollment connects the agent to your KACE SMA and downloads kbot scripts. You do not need to run this manually. -
When running
koneaorrunkbotmanually, ensure PATH includeskillall(psmisc) andtrue(coreutils). The systemd services automatically add these to PATH; for manual runs, usesudo systemctl start koneaor add them manually. -
The agent logs to
/var/log/quest/kace/. You can view logs withjournalctl -u konea.service. -
The
amp.conffile is created at/var/quest/kace/amp.confwith the host and any additionalampConfsettings. -
Depending on your KACE SMA configuration and agent version, you may need to perform a manual enrollment step after the services start to fully configure the agent. The initial configuration service handles this automatically via
konea -enable.