From 74027b44d76d7bbfd995c8b08650202b8e743ba0 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Thu, 2 Jan 2025 23:56:49 +0000 Subject: [PATCH] extract log persistence config from s6 to new module because it frobs kernel config, it breaks levitate as levitate evalModules doesn't include the kernel --- default.nix | 1 + modules/logging.nix | 19 +++++++++++++++++++ modules/s6/default.nix | 10 +--------- 3 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 modules/logging.nix diff --git a/default.nix b/default.nix index d69db80c..eb72e57b 100644 --- a/default.nix +++ b/default.nix @@ -33,6 +33,7 @@ let ./modules/busybox.nix ./modules/hostname.nix ./modules/kernel + ./modules/logging.nix ./modules/klogd.nix device.module liminix-config diff --git a/modules/logging.nix b/modules/logging.nix new file mode 100644 index 00000000..96b4a3b0 --- /dev/null +++ b/modules/logging.nix @@ -0,0 +1,19 @@ +{ config, lib, ... }: +let + inherit (lib) mkIf mkEnableOption mkOption types; +in { + options = { + logging = { + persistent = { + enable = mkEnableOption "store logs across reboots"; + }; + }; + }; + config = { + kernel.config = mkIf config.logging.persistent.enable { + PSTORE = "y"; + PSTORE_PMSG = "y"; + PSTORE_RAM = "y"; + }; + }; +} diff --git a/modules/s6/default.nix b/modules/s6/default.nix index 53d79680..08d71524 100644 --- a/modules/s6/default.nix +++ b/modules/s6/default.nix @@ -17,7 +17,7 @@ let logger = let pipecmds = ["${s6}/bin/s6-log -bpd3 -- ${cfg.script} 1"] ++ - (lib.optional cfg.persistent.enable + (lib.optional (cfg ? persistent && cfg.persistent.enable) "/bin/tee /dev/pmsg0") ++ (lib.optional cfg.shipping.enable "${pkgs.logshipper}/bin/logtap ${cfg.shipping.socket} logshipper-socket-event"); @@ -215,9 +215,6 @@ let in { options = { logging = { - persistent = { - enable = mkEnableOption "store logs across reboots"; - }; shipping = { enable = mkEnableOption "unix socket for log shipping"; socket = mkOption { @@ -269,11 +266,6 @@ in { )]; config = { - kernel.config = mkIf config.logging.persistent.enable { - PSTORE = "y"; - PSTORE_PMSG = "y"; - PSTORE_RAM = "y"; - }; filesystem = dir { etc = dir { s6-rc = dir {