Merge master into closure-size
The kde-5 stuff still didn't merge well. I hand-fixed what I saw, but there may be more problems.
This commit is contained in:
@@ -31,18 +31,19 @@ in
|
||||
system.activationScripts = mkOption {
|
||||
default = {};
|
||||
|
||||
example = {
|
||||
stdio = {
|
||||
text = ''
|
||||
# Needed by some programs.
|
||||
ln -sfn /proc/self/fd /dev/fd
|
||||
ln -sfn /proc/self/fd/0 /dev/stdin
|
||||
ln -sfn /proc/self/fd/1 /dev/stdout
|
||||
ln -sfn /proc/self/fd/2 /dev/stderr
|
||||
'';
|
||||
deps = [];
|
||||
};
|
||||
};
|
||||
example = literalExample ''
|
||||
{ stdio = {
|
||||
text = '''
|
||||
# Needed by some programs.
|
||||
ln -sfn /proc/self/fd /dev/fd
|
||||
ln -sfn /proc/self/fd/0 /dev/stdin
|
||||
ln -sfn /proc/self/fd/1 /dev/stdout
|
||||
ln -sfn /proc/self/fd/2 /dev/stderr
|
||||
''';
|
||||
deps = [];
|
||||
};
|
||||
}
|
||||
'';
|
||||
|
||||
description = ''
|
||||
A set of shell script fragments that are executed when a NixOS
|
||||
|
||||
@@ -261,12 +261,12 @@ while (my ($unit, $state) = each %{$activePrev}) {
|
||||
|
||||
sub pathToUnitName {
|
||||
my ($path) = @_;
|
||||
die unless substr($path, 0, 1) eq "/";
|
||||
return "-" if $path eq "/";
|
||||
$path = substr($path, 1);
|
||||
$path =~ s/\//-/g;
|
||||
# FIXME: handle - and unprintable characters.
|
||||
return $path;
|
||||
open my $cmd, "-|", "systemd-escape", "--suffix=mount", "-p", $path
|
||||
or die "Unable to escape $path!\n";
|
||||
my $escaped = join "", <$cmd>;
|
||||
chomp $escaped;
|
||||
close $cmd or die;
|
||||
return $escaped;
|
||||
}
|
||||
|
||||
sub unique {
|
||||
@@ -290,7 +290,7 @@ my ($newFss, $newSwaps) = parseFstab "$out/etc/fstab";
|
||||
foreach my $mountPoint (keys %$prevFss) {
|
||||
my $prev = $prevFss->{$mountPoint};
|
||||
my $new = $newFss->{$mountPoint};
|
||||
my $unit = pathToUnitName($mountPoint) . ".mount";
|
||||
my $unit = pathToUnitName($mountPoint);
|
||||
if (!defined $new) {
|
||||
# Filesystem entry disappeared, so unmount it.
|
||||
$unitsToStop{$unit} = 1;
|
||||
|
||||
@@ -178,9 +178,10 @@ in
|
||||
default = false;
|
||||
description = ''
|
||||
If enabled, copies the NixOS configuration file
|
||||
<literal>$NIXOS_CONFIG</literal> (usually
|
||||
<filename>/etc/nixos/configuration.nix</filename>)
|
||||
to the system store path.
|
||||
(usually <filename>/etc/nixos/configuration.nix</filename>)
|
||||
and links it from the resulting system
|
||||
(getting to <filename>/run/current-system/configuration.nix</filename>).
|
||||
Note that only this single file is copied, even if it imports others.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -238,7 +239,9 @@ in
|
||||
system.extraSystemBuilderCmds =
|
||||
optionalString
|
||||
config.system.copySystemConfiguration
|
||||
"cp ${maybeEnv "NIXOS_CONFIG" "/etc/nixos/configuration.nix"} $out";
|
||||
''ln -s '${import ../../../lib/from-env.nix "NIXOS_CONFIG" <nixos-config>}' \
|
||||
"$out/configuration.nix"
|
||||
'';
|
||||
|
||||
system.build.toplevel = system;
|
||||
|
||||
|
||||
@@ -71,6 +71,23 @@ mount -t devtmpfs -o "size=@devSize@" devtmpfs /dev
|
||||
mkdir -p /run
|
||||
mount -t tmpfs -o "mode=0755,size=@runSize@" tmpfs /run
|
||||
|
||||
# Log the script output to /dev/kmsg or /run/log/stage-1-init.log.
|
||||
mkdir -p /tmp
|
||||
mkfifo /tmp/stage-1-init.log.fifo
|
||||
logOutFd=8 && logErrFd=9
|
||||
eval "exec $logOutFd>&1 $logErrFd>&2"
|
||||
if test -w /dev/kmsg; then
|
||||
tee -i < /tmp/stage-1-init.log.fifo /proc/self/fd/"$logOutFd" | while read -r line; do
|
||||
if test -n "$line"; then
|
||||
echo "<7>stage-1-init: $line" > /dev/kmsg
|
||||
fi
|
||||
done &
|
||||
else
|
||||
mkdir -p /run/log
|
||||
tee -i < /tmp/stage-1-init.log.fifo /run/log/stage-1-init.log &
|
||||
fi
|
||||
exec > /tmp/stage-1-init.log.fifo 2>&1
|
||||
|
||||
|
||||
# Process the kernel command line.
|
||||
export stage2Init=/init
|
||||
@@ -415,6 +432,14 @@ fi
|
||||
# Stop udevd.
|
||||
udevadm control --exit
|
||||
|
||||
# Reset the logging file descriptors.
|
||||
# Do this just before pkill, which will kill the tee process.
|
||||
if test -n "@logCommands@"
|
||||
then
|
||||
exec 1>&$logOutFd 2>&$logErrFd
|
||||
eval "exec $logOutFd>&- $logErrFd>&-"
|
||||
fi
|
||||
|
||||
# Kill any remaining processes, just to be sure we're not taking any
|
||||
# with us into stage 2. But keep storage daemons like unionfs-fuse.
|
||||
pkill -9 -v -f '@'
|
||||
|
||||
@@ -155,6 +155,21 @@ mkdir -m 0755 -p /var/setuid-wrappers
|
||||
mount -t tmpfs -o "mode=0755" tmpfs /var/setuid-wrappers
|
||||
|
||||
|
||||
# Log the script output to /dev/kmsg or /run/log/stage-2-init.log.
|
||||
# Only at this point are all the necessary prerequisites ready for these commands.
|
||||
exec {logOutFd}>&1 {logErrFd}>&2
|
||||
if test -w /dev/kmsg; then
|
||||
exec > >(tee -i /proc/self/fd/"$logOutFd" | while read -r line; do
|
||||
if test -n "$line"; then
|
||||
echo "<7>stage-2-init: $line" > /dev/kmsg
|
||||
fi
|
||||
done) 2>&1
|
||||
else
|
||||
mkdir -p /run/log
|
||||
exec > >(tee -i /run/log/stage-2-init.log) 2>&1
|
||||
fi
|
||||
|
||||
|
||||
# Run the script that performs all configuration activation that does
|
||||
# not have to be done at boot time.
|
||||
echo "running activation script..."
|
||||
@@ -182,6 +197,11 @@ ln -sfn /run/booted-system /nix/var/nix/gcroots/booted-system
|
||||
@shell@ @postBootCommands@
|
||||
|
||||
|
||||
# Reset the logging file descriptors.
|
||||
exec 1>&$logOutFd 2>&$logErrFd
|
||||
exec {logOutFd}>&- {logErrFd}>&-
|
||||
|
||||
|
||||
# Start systemd.
|
||||
echo "starting systemd..."
|
||||
PATH=/run/current-system/systemd/lib/systemd \
|
||||
|
||||
@@ -160,6 +160,7 @@ let
|
||||
"systemd-timedated.service"
|
||||
"systemd-localed.service"
|
||||
"systemd-hostnamed.service"
|
||||
"systemd-binfmt.service"
|
||||
]
|
||||
|
||||
++ cfg.additionalUpstreamSystemUnits;
|
||||
@@ -779,6 +780,7 @@ in
|
||||
systemd.services.systemd-user-sessions.restartIfChanged = false; # Restart kills all active sessions.
|
||||
systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true;
|
||||
systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true;
|
||||
systemd.services.systemd-binfmt.wants = [ "proc-sys-fs-binfmt_misc.automount" ];
|
||||
|
||||
# Don't bother with certain units in containers.
|
||||
systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container";
|
||||
|
||||
Reference in New Issue
Block a user