fix critical bug relating to log-clearing

This commit is contained in:
root 2025-11-08 20:17:48 +00:00
parent 9d41477805
commit 2bdeadfa7a

View file

@ -1,8 +1,11 @@
{pkgs, ...}: let
updateScript = pkgs.writeShellScriptBin "rebuild" ''
#!/bin/sh
nixos-rebuild switch --flake /etc/nixos#distrust
'';
clearLogsScript = pkgs.writeShellScriptBin "clear_logs" ''
${pkgs.coreutils}/bin/rm -rf /var/log/*
${pkgs.systemd}/bin/journalctl --vacuum-time=0s
'';
tor-hostname = import ../helpers/tor-hostname.nix {inherit pkgs;};
in {
environment.systemPackages = with pkgs; [vim btop git alejandra statix deadnix] ++ [updateScript tor-hostname];
@ -41,7 +44,7 @@ in {
description = "Clear /var/log directory";
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/rm -rf /var/log/*";
ExecStart = "${clearLogsScript}/bin/clear_logs";
User = "root";
Group = "root";
};