Skip to content

Commit

Permalink
nixos/rasdaemon: add package option
Browse files Browse the repository at this point in the history
  • Loading branch information
matdibu committed Jan 16, 2025
1 parent e4d8c19 commit 00dda5b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions nixos/modules/services/hardware/rasdaemon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ in

enable = lib.mkEnableOption "RAS logging daemon";

package = lib.mkPackageOption pkgs "rasdaemon" { };

record = lib.mkOption {
type = lib.types.bool;
default = true;
Expand Down Expand Up @@ -99,7 +101,7 @@ in
};
};
environment.systemPackages =
[ pkgs.rasdaemon ]
[ cfg.package ]
++ lib.optionals (cfg.testing) (
with pkgs.error-inject;
[
Expand Down Expand Up @@ -151,12 +153,12 @@ in
StateDirectory = lib.optionalString (cfg.record) "rasdaemon";

ExecStart =
"${pkgs.rasdaemon}/bin/rasdaemon --foreground" + lib.optionalString (cfg.record) " --record";
ExecStop = "${pkgs.rasdaemon}/bin/rasdaemon --disable";
"${cfg.package}/bin/rasdaemon --foreground" + lib.optionalString (cfg.record) " --record";
ExecStop = "${cfg.package}/bin/rasdaemon --disable";
Restart = "on-abort";

# src/misc/rasdaemon.service.in shows this:
# ExecStartPost = ${pkgs.rasdaemon}/bin/rasdaemon --enable
# ExecStartPost = ${cfg.package}/bin/rasdaemon --enable
# but that results in unpredictable existence of the database
# and everything seems to be enabled without this...
};
Expand All @@ -167,7 +169,7 @@ in
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.rasdaemon}/bin/ras-mc-ctl --register-labels";
ExecStart = "${cfg.package}/bin/ras-mc-ctl --register-labels";
RemainAfterExit = true;
};
};
Expand Down

0 comments on commit 00dda5b

Please sign in to comment.