Merge remote-tracking branch 'upstream/master' into wrapper-pname-support
This commit is contained in:
@@ -218,7 +218,7 @@ in
|
||||
|
||||
systemd.user = {
|
||||
services.nixos-activation = {
|
||||
description = "Run user specific NixOS activation";
|
||||
description = "Run user-specific NixOS activation";
|
||||
script = config.system.userActivationScripts.script;
|
||||
unitConfig.ConditionUser = "!@system";
|
||||
serviceConfig.Type = "oneshot";
|
||||
|
||||
@@ -10,6 +10,9 @@ use Cwd 'abs_path';
|
||||
|
||||
my $out = "@out@";
|
||||
|
||||
# FIXME: maybe we should use /proc/1/exe to get the current systemd.
|
||||
my $curSystemd = abs_path("/run/current-system/sw/bin");
|
||||
|
||||
# To be robust against interruption, record what units need to be started etc.
|
||||
my $startListFile = "/run/systemd/start-list";
|
||||
my $restartListFile = "/run/systemd/restart-list";
|
||||
@@ -267,7 +270,7 @@ while (my ($unit, $state) = each %{$activePrev}) {
|
||||
sub pathToUnitName {
|
||||
my ($path) = @_;
|
||||
# Use current version of systemctl binary before daemon is reexeced.
|
||||
open my $cmd, "-|", "/run/current-system/sw/bin/systemd-escape", "--suffix=mount", "-p", $path
|
||||
open my $cmd, "-|", "$curSystemd/systemd-escape", "--suffix=mount", "-p", $path
|
||||
or die "Unable to escape $path!\n";
|
||||
my $escaped = join "", <$cmd>;
|
||||
chomp $escaped;
|
||||
@@ -370,7 +373,7 @@ if (scalar (keys %unitsToStop) > 0) {
|
||||
print STDERR "stopping the following units: ", join(", ", @unitsToStopFiltered), "\n"
|
||||
if scalar @unitsToStopFiltered;
|
||||
# Use current version of systemctl binary before daemon is reexeced.
|
||||
system("/run/current-system/sw/bin/systemctl", "stop", "--", sort(keys %unitsToStop)); # FIXME: ignore errors?
|
||||
system("$curSystemd/systemctl", "stop", "--", sort(keys %unitsToStop)); # FIXME: ignore errors?
|
||||
}
|
||||
|
||||
print STDERR "NOT restarting the following changed units: ", join(", ", sort(keys %unitsToSkip)), "\n"
|
||||
@@ -382,10 +385,12 @@ my $res = 0;
|
||||
print STDERR "activating the configuration...\n";
|
||||
system("$out/activate", "$out") == 0 or $res = 2;
|
||||
|
||||
# Restart systemd if necessary.
|
||||
# Restart systemd if necessary. Note that this is done using the
|
||||
# current version of systemd, just in case the new one has trouble
|
||||
# communicating with the running pid 1.
|
||||
if ($restartSystemd) {
|
||||
print STDERR "restarting systemd...\n";
|
||||
system("@systemd@/bin/systemctl", "daemon-reexec") == 0 or $res = 2;
|
||||
system("$curSystemd/systemctl", "daemon-reexec") == 0 or $res = 2;
|
||||
}
|
||||
|
||||
# Forget about previously failed services.
|
||||
@@ -401,8 +406,10 @@ while (my $f = <$listActiveUsers>) {
|
||||
my ($uid, $name) = ($+{uid}, $+{user});
|
||||
print STDERR "reloading user units for $name...\n";
|
||||
|
||||
system("@su@", "-s", "@shell@", "-l", $name, "-c", "XDG_RUNTIME_DIR=/run/user/$uid @systemd@/bin/systemctl --user daemon-reload");
|
||||
system("@su@", "-s", "@shell@", "-l", $name, "-c", "XDG_RUNTIME_DIR=/run/user/$uid @systemd@/bin/systemctl --user start nixos-activation.service");
|
||||
system("@su@", "-s", "@shell@", "-l", $name, "-c",
|
||||
"export XDG_RUNTIME_DIR=/run/user/$uid; " .
|
||||
"$curSystemd/systemctl --user daemon-reexec; " .
|
||||
"@systemd@/bin/systemctl --user start nixos-activation.service");
|
||||
}
|
||||
|
||||
close $listActiveUsers;
|
||||
|
||||
@@ -108,7 +108,7 @@ in
|
||||
boot.extraModulePackages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [];
|
||||
example = literalExample "[ pkgs.linuxPackages.nvidia_x11 ]";
|
||||
example = literalExample "[ config.boot.kernelPackages.nvidia_x11 ]";
|
||||
description = "A list of additional packages supplying kernel modules.";
|
||||
};
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ addEntry() {
|
||||
|
||||
local kernel=$(readlink -f $path/kernel)
|
||||
local initrd=$(readlink -f $path/initrd)
|
||||
local dtb_path=$(readlink -f $path/kernel-modules/dtbs)
|
||||
local dtb_path=$(readlink -f $path/dtbs)
|
||||
|
||||
if test -n "@copyKernels@"; then
|
||||
copyToKernelsDir $kernel; kernel=$result
|
||||
@@ -113,10 +113,18 @@ done
|
||||
fwdir=@firmware@/share/raspberrypi/boot/
|
||||
copyForced $fwdir/bootcode.bin $target/bootcode.bin
|
||||
copyForced $fwdir/fixup.dat $target/fixup.dat
|
||||
copyForced $fwdir/fixup4.dat $target/fixup4.dat
|
||||
copyForced $fwdir/fixup4cd.dat $target/fixup4cd.dat
|
||||
copyForced $fwdir/fixup4db.dat $target/fixup4db.dat
|
||||
copyForced $fwdir/fixup4x.dat $target/fixup4x.dat
|
||||
copyForced $fwdir/fixup_cd.dat $target/fixup_cd.dat
|
||||
copyForced $fwdir/fixup_db.dat $target/fixup_db.dat
|
||||
copyForced $fwdir/fixup_x.dat $target/fixup_x.dat
|
||||
copyForced $fwdir/start.elf $target/start.elf
|
||||
copyForced $fwdir/start4.elf $target/start4.elf
|
||||
copyForced $fwdir/start4cd.elf $target/start4cd.elf
|
||||
copyForced $fwdir/start4db.elf $target/start4db.elf
|
||||
copyForced $fwdir/start4x.elf $target/start4x.elf
|
||||
copyForced $fwdir/start_cd.elf $target/start_cd.elf
|
||||
copyForced $fwdir/start_db.elf $target/start_db.elf
|
||||
copyForced $fwdir/start_x.elf $target/start_x.elf
|
||||
|
||||
@@ -59,7 +59,7 @@ in
|
||||
|
||||
version = mkOption {
|
||||
default = 2;
|
||||
type = types.enum [ 0 1 2 3 ];
|
||||
type = types.enum [ 0 1 2 3 4 ];
|
||||
description = ''
|
||||
'';
|
||||
};
|
||||
@@ -97,8 +97,8 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = singleton {
|
||||
assertion = !pkgs.stdenv.hostPlatform.isAarch64 || cfg.version == 3;
|
||||
message = "Only Raspberry Pi 3 supports aarch64.";
|
||||
assertion = !pkgs.stdenv.hostPlatform.isAarch64 || cfg.version >= 3;
|
||||
message = "Only Raspberry Pi >= 3 supports aarch64.";
|
||||
};
|
||||
|
||||
system.build.installBootLoader = builder;
|
||||
|
||||
@@ -10,11 +10,13 @@ let
|
||||
pkgs.ubootRaspberryPi
|
||||
else if version == 2 then
|
||||
pkgs.ubootRaspberryPi2
|
||||
else
|
||||
else if version == 3 then
|
||||
if isAarch64 then
|
||||
pkgs.ubootRaspberryPi3_64bit
|
||||
else
|
||||
pkgs.ubootRaspberryPi3_32bit;
|
||||
pkgs.ubootRaspberryPi3_32bit
|
||||
else
|
||||
throw "U-Boot is not yet supported on the raspberry pi 4.";
|
||||
|
||||
extlinuxConfBuilder =
|
||||
import ../generic-extlinux-compatible/extlinux-conf-builder.nix {
|
||||
|
||||
@@ -10,7 +10,7 @@ let
|
||||
|
||||
checkLink = checkUnitConfig "Link" [
|
||||
(assertOnlyFields [
|
||||
"Description" "Alias" "MACAddressPolicy" "MACAddress" "NamePolicy" "OriginalName"
|
||||
"Description" "Alias" "MACAddressPolicy" "MACAddress" "NamePolicy" "Name" "OriginalName"
|
||||
"MTUBytes" "BitsPerSecond" "Duplex" "AutoNegotiation" "WakeOnLan" "Port"
|
||||
"TCPSegmentationOffload" "TCP6SegmentationOffload" "GenericSegmentationOffload"
|
||||
"GenericReceiveOffload" "LargeReceiveOffload" "RxChannels" "TxChannels"
|
||||
@@ -187,7 +187,7 @@ let
|
||||
# Note: For DHCP the values both, none, v4, v6 are deprecated
|
||||
(assertValueOneOf "DHCP" ["yes" "no" "ipv4" "ipv6" "both" "none" "v4" "v6"])
|
||||
(assertValueOneOf "DHCPServer" boolValues)
|
||||
(assertValueOneOf "LinkLocalAddressing" ["yes" "no" "ipv4" "ipv6"])
|
||||
(assertValueOneOf "LinkLocalAddressing" ["yes" "no" "ipv4" "ipv6" "ipv4-fallback" "fallback"])
|
||||
(assertValueOneOf "IPv4LLRoute" boolValues)
|
||||
(assertValueOneOf "LLMNR" ["yes" "resolve" "no"])
|
||||
(assertValueOneOf "MulticastDNS" ["yes" "resolve" "no"])
|
||||
@@ -201,7 +201,7 @@ let
|
||||
(assertValueOneOf "IPv6AcceptRA" boolValues)
|
||||
(assertValueOneOf "IPv4ProxyARP" boolValues)
|
||||
(assertValueOneOf "IPv6ProxyNDP" boolValues)
|
||||
(assertValueOneOf "IPv6PrefixDelegation" boolValues)
|
||||
(assertValueOneOf "IPv6PrefixDelegation" (boolValues ++ [ "dhcpv6" "static" ]))
|
||||
(assertValueOneOf "ActiveSlave" boolValues)
|
||||
(assertValueOneOf "PrimarySlave" boolValues)
|
||||
(assertValueOneOf "ConfigureWithoutCarrier" boolValues)
|
||||
|
||||
@@ -5,23 +5,27 @@ with lib;
|
||||
let
|
||||
|
||||
inherit (pkgs) plymouth;
|
||||
inherit (pkgs) nixos-icons;
|
||||
|
||||
cfg = config.boot.plymouth;
|
||||
|
||||
breezePlymouth = pkgs.breeze-plymouth.override {
|
||||
nixosBranding = true;
|
||||
nixosVersion = config.system.nixos.release;
|
||||
nixosBreezePlymouth = pkgs.breeze-plymouth.override {
|
||||
logoFile = cfg.logo;
|
||||
logoName = "nixos";
|
||||
osName = "NixOS";
|
||||
osVersion = config.system.nixos.release;
|
||||
};
|
||||
|
||||
themesEnv = pkgs.buildEnv {
|
||||
name = "plymouth-themes";
|
||||
paths = [ plymouth breezePlymouth ] ++ cfg.themePackages;
|
||||
paths = [ plymouth ] ++ cfg.themePackages;
|
||||
};
|
||||
|
||||
configFile = pkgs.writeText "plymouthd.conf" ''
|
||||
[Daemon]
|
||||
ShowDelay=0
|
||||
Theme=${cfg.theme}
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
in
|
||||
@@ -35,7 +39,7 @@ in
|
||||
enable = mkEnableOption "Plymouth boot splash screen";
|
||||
|
||||
themePackages = mkOption {
|
||||
default = [];
|
||||
default = [ nixosBreezePlymouth ];
|
||||
type = types.listOf types.package;
|
||||
description = ''
|
||||
Extra theme packages for plymouth.
|
||||
@@ -52,10 +56,7 @@ in
|
||||
|
||||
logo = mkOption {
|
||||
type = types.path;
|
||||
default = pkgs.fetchurl {
|
||||
url = "https://nixos.org/logo/nixos-hires.png";
|
||||
sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si";
|
||||
};
|
||||
default = "${nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png";
|
||||
defaultText = ''pkgs.fetchurl {
|
||||
url = "https://nixos.org/logo/nixos-hires.png";
|
||||
sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si";
|
||||
@@ -65,6 +66,15 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Literal string to append to <literal>configFile</literal>
|
||||
and the config file generated by the plymouth module.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
@@ -88,10 +98,7 @@ in
|
||||
systemd.services.plymouth-kexec.wantedBy = [ "kexec.target" ];
|
||||
systemd.services.plymouth-halt.wantedBy = [ "halt.target" ];
|
||||
systemd.services.plymouth-quit-wait.wantedBy = [ "multi-user.target" ];
|
||||
systemd.services.plymouth-quit = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "display-manager.service" ];
|
||||
};
|
||||
systemd.services.plymouth-quit.wantedBy = [ "multi-user.target" ];
|
||||
systemd.services.plymouth-poweroff.wantedBy = [ "poweroff.target" ];
|
||||
systemd.services.plymouth-reboot.wantedBy = [ "reboot.target" ];
|
||||
systemd.services.plymouth-read-write.wantedBy = [ "sysinit.target" ];
|
||||
|
||||
@@ -183,6 +183,12 @@ for o in $(cat /proc/cmdline); do
|
||||
copytoram)
|
||||
copytoram=1
|
||||
;;
|
||||
findiso=*)
|
||||
# if an iso name is supplied, try to find the device where
|
||||
# the iso resides on
|
||||
set -- $(IFS==; echo $o)
|
||||
isoPath=$2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -442,6 +448,27 @@ if test -e /sys/power/resume -a -e /sys/power/disk; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# If we have a path to an iso file, find the iso and link it to /dev/root
|
||||
if [ -n "$isoPath" ]; then
|
||||
mkdir -p /findiso
|
||||
|
||||
for delay in 5 10; do
|
||||
blkid | while read -r line; do
|
||||
device=$(echo "$line" | sed 's/:.*//')
|
||||
type=$(echo "$line" | sed 's/.*TYPE="\([^"]*\)".*/\1/')
|
||||
|
||||
mount -t "$type" "$device" /findiso
|
||||
if [ -e "/findiso$isoPath" ]; then
|
||||
ln -sf "/findiso$isoPath" /dev/root
|
||||
break 2
|
||||
else
|
||||
umount /findiso
|
||||
fi
|
||||
done
|
||||
|
||||
sleep "$delay"
|
||||
done
|
||||
fi
|
||||
|
||||
# Try to find and mount the root device.
|
||||
mkdir -p $targetRoot
|
||||
|
||||
@@ -142,7 +142,7 @@ fi
|
||||
# Record the boot configuration.
|
||||
ln -sfn "$systemConfig" /run/booted-system
|
||||
|
||||
# Prevent the booted system form being garbage-collected If it weren't
|
||||
# Prevent the booted system from being garbage-collected. If it weren't
|
||||
# a gcroot, if we were running a different kernel, switched system,
|
||||
# and garbage collected all, we could not load kernel modules anymore.
|
||||
ln -sfn /run/booted-system /nix/var/nix/gcroots/booted-system
|
||||
|
||||
@@ -113,11 +113,21 @@ in {
|
||||
config =
|
||||
let
|
||||
units = mapAttrs' (n: v: let nspawnFile = "${n}.nspawn"; in nameValuePair nspawnFile (instanceToUnit nspawnFile v)) cfg;
|
||||
in mkIf (cfg != {}) {
|
||||
|
||||
environment.etc."systemd/nspawn".source = generateUnits "nspawn" units [] [];
|
||||
|
||||
systemd.targets.multi-user.wants = [ "machines.target" ];
|
||||
};
|
||||
in
|
||||
mkMerge [
|
||||
(mkIf (cfg != {}) {
|
||||
environment.etc."systemd/nspawn".source = mkIf (cfg != {}) (generateUnits "nspawn" units [] []);
|
||||
})
|
||||
{
|
||||
systemd.targets.multi-user.wants = [ "machines.target" ];
|
||||
|
||||
# Workaround for https://github.com/NixOS/nixpkgs/pull/67232#issuecomment-531315437 and https://github.com/systemd/systemd/issues/13622
|
||||
# Once systemd fixes this upstream, we can re-enable -U
|
||||
systemd.services."systemd-nspawn@".serviceConfig.ExecStart = [
|
||||
"" # deliberately empty. signals systemd to override the ExecStart
|
||||
# Only difference between upstream is that we do not pass the -U flag
|
||||
"${pkgs.systemd}/bin/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network-veth --settings=override --machine=%i"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ in rec {
|
||||
in
|
||||
if isList (head defs'')
|
||||
then concatLists defs''
|
||||
else mergeOneOption loc defs';
|
||||
else mergeEqualOption loc defs';
|
||||
};
|
||||
|
||||
sharedOptions = {
|
||||
|
||||
@@ -63,6 +63,7 @@ let
|
||||
"systemd-logind.service"
|
||||
"autovt@.service"
|
||||
"systemd-user-sessions.service"
|
||||
"dbus-org.freedesktop.import1.service"
|
||||
"dbus-org.freedesktop.machine1.service"
|
||||
"user@.service"
|
||||
"user-runtime-dir@.service"
|
||||
@@ -145,6 +146,7 @@ let
|
||||
"user.slice"
|
||||
"machine.slice"
|
||||
"machines.target"
|
||||
"systemd-importd.service"
|
||||
"systemd-machined.service"
|
||||
"systemd-nspawn@.service"
|
||||
|
||||
@@ -546,6 +548,16 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.coredump.enable = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether core dumps should be processed by
|
||||
<command>systemd-coredump</command>. If disabled, core dumps
|
||||
appear in the current directory of the crashing process.
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.coredump.extraConfig = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
@@ -858,7 +870,12 @@ in
|
||||
"sysctl.d/50-coredump.conf".source = "${systemd}/example/sysctl.d/50-coredump.conf";
|
||||
"sysctl.d/50-default.conf".source = "${systemd}/example/sysctl.d/50-default.conf";
|
||||
|
||||
"tmpfiles.d/journal-nocow.conf".source = "${systemd}/example/tmpfiles.d/journal-nocow.conf";
|
||||
"tmpfiles.d/static-nodes-permissions.conf".source = "${systemd}/example/tmpfiles.d/static-nodes-permissions.conf";
|
||||
"tmpfiles.d/systemd.conf".source = "${systemd}/example/tmpfiles.d/systemd.conf";
|
||||
"tmpfiles.d/systemd-nspawn.conf".source = "${systemd}/example/tmpfiles.d/systemd-nspawn.conf";
|
||||
"tmpfiles.d/systemd-tmp.conf".source = "${systemd}/example/tmpfiles.d/systemd-tmp.conf";
|
||||
"tmpfiles.d/var.conf".source = "${systemd}/example/tmpfiles.d/var.conf";
|
||||
"tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf";
|
||||
|
||||
"tmpfiles.d/nixos.conf".text = ''
|
||||
@@ -978,6 +995,10 @@ in
|
||||
# Don't bother with certain units in containers.
|
||||
systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container";
|
||||
systemd.services.systemd-random-seed.unitConfig.ConditionVirtualization = "!container";
|
||||
|
||||
boot.kernel.sysctl = mkIf (!cfg.coredump.enable) {
|
||||
"kernel.core_pattern" = "core";
|
||||
};
|
||||
};
|
||||
|
||||
# FIXME: Remove these eventually.
|
||||
|
||||
@@ -20,6 +20,18 @@ with lib;
|
||||
The set of NTP servers from which to synchronise.
|
||||
'';
|
||||
};
|
||||
extraConfig = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
example = ''
|
||||
PollIntervalMaxSec=180
|
||||
'';
|
||||
description = ''
|
||||
Extra config options for systemd-timesyncd. See
|
||||
<link xlink:href="https://www.freedesktop.org/software/systemd/man/timesyncd.conf.html">
|
||||
timesyncd.conf(5)</link> for available options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -35,6 +47,7 @@ with lib;
|
||||
environment.etc."systemd/timesyncd.conf".text = ''
|
||||
[Time]
|
||||
NTP=${concatStringsSep " " config.services.timesyncd.servers}
|
||||
${config.services.timesyncd.extraConfig}
|
||||
'';
|
||||
|
||||
users.users.systemd-timesync.uid = config.ids.uids.systemd-timesync;
|
||||
|
||||
Reference in New Issue
Block a user