journald: enable logging to the console
This commit is contained in:
parent
425ec4cb00
commit
6419172bc2
@ -295,21 +295,21 @@ let
|
|||||||
|
|
||||||
units = pkgs.runCommand "units" { preferLocalBuild = true; }
|
units = pkgs.runCommand "units" { preferLocalBuild = true; }
|
||||||
''
|
''
|
||||||
mkdir -p $out/system
|
mkdir -p $out
|
||||||
for i in ${toString upstreamUnits}; do
|
for i in ${toString upstreamUnits}; do
|
||||||
fn=${systemd}/example/systemd/system/$i
|
fn=${systemd}/example/systemd/system/$i
|
||||||
[ -e $fn ]
|
[ -e $fn ]
|
||||||
if [ -L $fn ]; then
|
if [ -L $fn ]; then
|
||||||
cp -pd $fn $out/system/
|
cp -pd $fn $out/
|
||||||
else
|
else
|
||||||
ln -s $fn $out/system
|
ln -s $fn $out/
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in ${toString upstreamWants}; do
|
for i in ${toString upstreamWants}; do
|
||||||
fn=${systemd}/example/systemd/system/$i
|
fn=${systemd}/example/systemd/system/$i
|
||||||
[ -e $fn ]
|
[ -e $fn ]
|
||||||
x=$out/system/$(basename $fn)
|
x=$out/$(basename $fn)
|
||||||
mkdir $x
|
mkdir $x
|
||||||
for i in $fn/*; do
|
for i in $fn/*; do
|
||||||
y=$x/$(basename $i)
|
y=$x/$(basename $i)
|
||||||
@ -319,16 +319,16 @@ let
|
|||||||
done
|
done
|
||||||
|
|
||||||
for i in ${toString nixosUnits}; do
|
for i in ${toString nixosUnits}; do
|
||||||
cp $i/* $out/system
|
cp $i/* $out/
|
||||||
done
|
done
|
||||||
|
|
||||||
${concatStrings (mapAttrsToList (name: unit:
|
${concatStrings (mapAttrsToList (name: unit:
|
||||||
concatMapStrings (name2: ''
|
concatMapStrings (name2: ''
|
||||||
mkdir -p $out/system/${name2}.wants
|
mkdir -p $out/${name2}.wants
|
||||||
ln -sfn ../${name} $out/system/${name2}.wants/
|
ln -sfn ../${name} $out/${name2}.wants/
|
||||||
'') unit.wantedBy) cfg.units)}
|
'') unit.wantedBy) cfg.units)}
|
||||||
|
|
||||||
ln -s ${cfg.defaultUnit} $out/system/default.target
|
ln -s ${cfg.defaultUnit} $out/default.target
|
||||||
''; # */
|
''; # */
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -373,6 +373,18 @@ in
|
|||||||
type = types.uniq types.string;
|
type = types.uniq types.string;
|
||||||
description = "Default unit started when the system boots.";
|
description = "Default unit started when the system boots.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.journald.logKernelMessages = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = "Whether to log kernel messages.";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.journald.console = mkOption {
|
||||||
|
default = "";
|
||||||
|
type = types.uniq types.string;
|
||||||
|
description = "If non-empty, write log messages to the specified TTY device. Defaults to /dev/console.";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -389,7 +401,20 @@ in
|
|||||||
|
|
||||||
environment.etc =
|
environment.etc =
|
||||||
[ { source = units;
|
[ { source = units;
|
||||||
target = "systemd";
|
target = "systemd/system";
|
||||||
|
}
|
||||||
|
{ source = pkgs.writeText "journald.conf"
|
||||||
|
''
|
||||||
|
[Journal]
|
||||||
|
${optionalString (config.services.journald.console != "") ''
|
||||||
|
ForwardToConsole=yes
|
||||||
|
TTYPath=${config.services.journald.console}
|
||||||
|
''}
|
||||||
|
${optionalString config.services.journald.logKernelMessages ''
|
||||||
|
ImportKernel=yes
|
||||||
|
''}
|
||||||
|
'';
|
||||||
|
target = "systemd/journald.conf";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -66,15 +66,8 @@ with pkgs.lib;
|
|||||||
# `xwininfo' is used by the test driver to query open windows.
|
# `xwininfo' is used by the test driver to query open windows.
|
||||||
environment.systemPackages = [ pkgs.xorg.xwininfo ];
|
environment.systemPackages = [ pkgs.xorg.xwininfo ];
|
||||||
|
|
||||||
# Send all of /var/log/messages to the serial port.
|
# Log everything to the serial console.
|
||||||
services.syslogd.extraConfig = "*.* /dev/ttyS0";
|
services.journald.console = "/dev/console";
|
||||||
|
|
||||||
# Disable "-- MARK --" messages. These prevent hanging tests from
|
|
||||||
# being killed after 1 hour of silence.
|
|
||||||
services.syslogd.extraParams = [ "-m 0" ];
|
|
||||||
|
|
||||||
# Don't run klogd. Kernel messages appear on the serial console anyway.
|
|
||||||
jobs.klogd.startOn = mkOverride 50 "";
|
|
||||||
|
|
||||||
# Prevent tests from accessing the Internet.
|
# Prevent tests from accessing the Internet.
|
||||||
networking.defaultGateway = mkOverride 150 "";
|
networking.defaultGateway = mkOverride 150 "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user