mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Services] Add journald configuration options
This commit is contained in:
parent
40509f9928
commit
9980c17d36
1 changed files with 31 additions and 0 deletions
31
services.nix
31
services.nix
|
|
@ -3,6 +3,24 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.aviallon.services;
|
cfg = config.aviallon.services;
|
||||||
desktopCfg = config.aviallon.desktop;
|
desktopCfg = config.aviallon.desktop;
|
||||||
|
generalCfg = config.aviallon.general;
|
||||||
|
|
||||||
|
journaldConfigValue = value:
|
||||||
|
if value == true then "true"
|
||||||
|
else if value == false then "false"
|
||||||
|
else if isList value then toString value
|
||||||
|
else generators.mkValueStringDefault { } value;
|
||||||
|
|
||||||
|
isNullOrEmpty = v: (v == null) ||
|
||||||
|
(isList v && (length v == 0));
|
||||||
|
|
||||||
|
journaldConfig = settings: (generators.toKeyValue {
|
||||||
|
mkKeyValue = generators.mkKeyValueDefault {
|
||||||
|
mkValueString = journaldConfigValue;
|
||||||
|
} "=";
|
||||||
|
} (filterAttrs (n: v: !(isNullOrEmpty v))
|
||||||
|
settings)
|
||||||
|
);
|
||||||
in {
|
in {
|
||||||
options.aviallon.services = {
|
options.aviallon.services = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
|
@ -11,6 +29,13 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Enable aviallon's services configuration";
|
description = "Enable aviallon's services configuration";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
journald.extraConfig = mkOption {
|
||||||
|
default = {};
|
||||||
|
example = {};
|
||||||
|
type = types.attrs;
|
||||||
|
description = "Add extra config to journald with Nix language";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
@ -33,6 +58,12 @@ in {
|
||||||
|
|
||||||
services.fwupd.enable = true;
|
services.fwupd.enable = true;
|
||||||
|
|
||||||
|
services.journald.extraConfig = journaldConfig cfg.journald.extraConfig;
|
||||||
|
|
||||||
|
aviallon.services.journald.extraConfig = ifEnable generalCfg.unsafeOptimizations {
|
||||||
|
Storage = "volatile";
|
||||||
|
};
|
||||||
|
|
||||||
services.ananicy.enable = true;
|
services.ananicy.enable = true;
|
||||||
services.ananicy.package = pkgs.ananicy-cpp;
|
services.ananicy.package = pkgs.ananicy-cpp;
|
||||||
services.ananicy.settings = {
|
services.ananicy.settings = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue