Skip to content

Commit

Permalink
Update nix configuration and unit file example
Browse files Browse the repository at this point in the history
  • Loading branch information
WombatFromHell committed Feb 15, 2025
1 parent c9fded6 commit 519e2e1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 21 additions & 2 deletions unit-example.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,32 @@
...
}: let
moduleName = "veridian-controller";
description = "Veridian Controller User Fan Service";
description = "Veridian Controller Fan Service";
in {
options."${moduleName}".enable = lib.mkEnableOption "Enable ${description}";

config = lib.mkIf config."${moduleName}".enable {
home.packages = [pkgs.${moduleName}];
# nixos unit example
environment.systemPackages = [pkgs.${moduleName}];
systemd = {
# ensure the config file exists with the right perms
tmpfiles.rules = [
"f /etc/veridian-controller.toml 0640 root root -"
];
services."${moduleName}" = {
description = "${description}";
wantedBy = ["multi-user.target"];
serviceConfig = {
Environment = "PATH=/run/wrappers/bin:${config.hardware.nvidia.package.settings}/bin:${config.hardware.nvidia.package.bin}/bin";
Type = "simple";
ExecStart = "${pkgs.${moduleName}}/bin/${moduleName} -f /etc/veridian-controller.toml";
TimeoutStopSec = 10;
};
};
};

# home-manager unit example
home.packages = [pkgs.${moduleName}];
systemd.user.services."${moduleName}" = {
Unit = {
Description = "${description}";
Expand Down
2 changes: 0 additions & 2 deletions veridian-controller.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Description=Veridian Controller Fan Monitoring Service
[Service]
Type=simple
ExecStart=%h/.local/bin/veridian-controller
Restart=on-failure
RestartSec=5
TimeoutStopSec=10

[Install]
Expand Down

0 comments on commit 519e2e1

Please sign in to comment.