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:
parent
4e46f3e0fc
commit
1629c8d5d2
@ -12,8 +12,8 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
# NixOS module (system-independent)
|
# Home Manager module (system-independent)
|
||||||
nixosModules.default = import ./nix/nixos-module.nix;
|
homeManagerModules.default = import ./nix/nixos-module.nix;
|
||||||
|
|
||||||
# Overlay to add systant to pkgs
|
# Overlay to add systant to pkgs
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systant;
|
cfg = config.services.systant;
|
||||||
settingsFormat = pkgs.formats.toml { };
|
settingsFormat = pkgs.formats.toml { };
|
||||||
configFile =
|
configFile =
|
||||||
if cfg.configFile != null
|
if cfg.configFile != null
|
||||||
@ -11,7 +11,7 @@ let
|
|||||||
else null;
|
else null;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.systant = {
|
options.services.systant = {
|
||||||
enable = lib.mkEnableOption "systant system monitoring agent";
|
enable = lib.mkEnableOption "systant system monitoring agent";
|
||||||
|
|
||||||
package = lib.mkOption {
|
package = lib.mkOption {
|
||||||
@ -62,17 +62,16 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# Make the package available system-wide
|
home.packages = [ cfg.package ];
|
||||||
environment.systemPackages = [ cfg.package ];
|
|
||||||
|
|
||||||
# Systemd user service - runs in user session with user's environment
|
|
||||||
systemd.user.services.systant = {
|
systemd.user.services.systant = {
|
||||||
description = "Systant system monitoring agent";
|
Unit = {
|
||||||
wantedBy = [ "default.target" ];
|
Description = "Systant system monitoring agent";
|
||||||
after = [ "network-online.target" ];
|
After = [ "network-online.target" ];
|
||||||
wants = [ "network-online.target" ];
|
Wants = [ "network-online.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
Service = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart =
|
ExecStart =
|
||||||
if configFile != null
|
if configFile != null
|
||||||
@ -81,6 +80,10 @@ in
|
|||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "5s";
|
RestartSec = "5s";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Install = {
|
||||||
|
WantedBy = [ "default.target" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user