refactor: switch to home-manager module

Systant is a userspace controller, so it makes sense to manage it
via home-manager rather than as a system service. This allows:
- Declarative per-user configuration
- Access to user's environment, PATH, and session
- Proper handling of audio, display, and other user resources

Usage in home-manager config:
  imports = [ inputs.systant.homeManagerModules.default ];
  services.systant.enable = true;
  services.systant.settings = { ... };

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
ryan 2026-01-19 21:02:09 -08:00
parent 4e46f3e0fc
commit 1629c8d5d2
2 changed files with 15 additions and 12 deletions

View File

@ -12,8 +12,8 @@
...
}:
{
# NixOS module (system-independent)
nixosModules.default = import ./nix/nixos-module.nix;
# Home Manager module (system-independent)
homeManagerModules.default = import ./nix/nixos-module.nix;
# Overlay to add systant to pkgs
overlays.default = final: prev: {

View File

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
let
cfg = config.systant;
cfg = config.services.systant;
settingsFormat = pkgs.formats.toml { };
configFile =
if cfg.configFile != null
@ -11,7 +11,7 @@ let
else null;
in
{
options.systant = {
options.services.systant = {
enable = lib.mkEnableOption "systant system monitoring agent";
package = lib.mkOption {
@ -62,17 +62,16 @@ in
};
config = lib.mkIf cfg.enable {
# Make the package available system-wide
environment.systemPackages = [ cfg.package ];
home.packages = [ cfg.package ];
# Systemd user service - runs in user session with user's environment
systemd.user.services.systant = {
description = "Systant system monitoring agent";
wantedBy = [ "default.target" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
Unit = {
Description = "Systant system monitoring agent";
After = [ "network-online.target" ];
Wants = [ "network-online.target" ];
};
serviceConfig = {
Service = {
Type = "simple";
ExecStart =
if configFile != null
@ -81,6 +80,10 @@ in
Restart = "on-failure";
RestartSec = "5s";
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
}