merge staging-nixos (#507730)
This commit is contained in:
@@ -149,6 +149,8 @@
|
||||
|
||||
- `services.uptime` has been removed because the package it relies on does not exist anymore in nixpkgs.
|
||||
|
||||
- `post-resume.target` has been removed. See {manpage}`systemd.special(7)` about `sleep.target` for instructions on ordering a process after resume with `ExecStop=`.
|
||||
|
||||
- `services.kubernetes.addons.dns.coredns` has been renamed to `services.kubernetes.addons.dns.corednsImage` and now expects a
|
||||
package instead of attrs. Now, by default, nixpkgs.coredns in conjunction with dockerTools.buildImage is used, instead
|
||||
of pulling the upstream container image from Docker Hub. If you want the old behavior, you can set:
|
||||
|
||||
@@ -90,68 +90,35 @@ in
|
||||
https://www.freedesktop.org/software/systemd/man/latest/systemd.special.html#sleep.target
|
||||
'';
|
||||
|
||||
systemd.targets.post-resume = {
|
||||
description = "Post-Resume Actions";
|
||||
requires = [ "post-resume.service" ];
|
||||
after = [ "post-resume.service" ];
|
||||
wantedBy = [ "sleep.target" ];
|
||||
unitConfig.StopWhenUnneeded = true;
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
# Service executed before suspending/hibernating.
|
||||
pre-sleep = {
|
||||
description = "Pre-Sleep Actions";
|
||||
sleep-actions = {
|
||||
description = "Sleep Actions";
|
||||
wantedBy = [ "sleep.target" ];
|
||||
before = [ "sleep.target" ];
|
||||
unitConfig.StopWhenUnneeded = true;
|
||||
script = ''
|
||||
# NixOS pre-sleep script
|
||||
|
||||
# config.powerManagement.powerDownCommands
|
||||
${cfg.powerDownCommands}
|
||||
'';
|
||||
serviceConfig.Type = "oneshot";
|
||||
};
|
||||
|
||||
# Service executed after resuming from suspend/hibernate
|
||||
post-resume = {
|
||||
description = "Post-Resume Actions";
|
||||
# Pulled in by post-resume.service above
|
||||
after = [ "sleep.target" ];
|
||||
script = ''
|
||||
preStop = ''
|
||||
# NixOS pre-resume script
|
||||
|
||||
/run/current-system/systemd/bin/systemctl try-restart --no-block post-resume.target
|
||||
|
||||
# config.powerManagement.resumeCommands
|
||||
${cfg.resumeCommands}
|
||||
|
||||
# config.powerManagement.powerUpCommands
|
||||
${cfg.powerUpCommands}
|
||||
'';
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Service executed before shutdown
|
||||
pre-shutdown = {
|
||||
description = "Pre-Shutdown Actions";
|
||||
wantedBy = [
|
||||
"shutdown.target"
|
||||
];
|
||||
before = [
|
||||
"shutdown.target"
|
||||
];
|
||||
script = ''
|
||||
# NixOS pre-shutdown script
|
||||
|
||||
# config.powerManagement.powerDownCommands
|
||||
${cfg.powerDownCommands}
|
||||
'';
|
||||
serviceConfig.Type = "oneshot";
|
||||
unitConfig.DefaultDependencies = false;
|
||||
};
|
||||
|
||||
# Service executed after boot
|
||||
# Service executed after boot, and stopped during shutdown
|
||||
post-boot = {
|
||||
description = "Post-Boot Actions";
|
||||
# It's not well defined at what point in the bootup sequence this should run
|
||||
@@ -167,6 +134,12 @@ in
|
||||
# config.powerManagement.powerUpCommands
|
||||
${cfg.powerUpCommands}
|
||||
'';
|
||||
preStop = ''
|
||||
# NixOS pre-shutdown script
|
||||
|
||||
# config.powerManagement.powerDownCommands
|
||||
${cfg.powerDownCommands}
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
|
||||
@@ -54,19 +54,49 @@ in
|
||||
};
|
||||
|
||||
# Provide the NixOS/Nixpkgs sources in /etc/nixos. This is required
|
||||
# for nixos-install.
|
||||
boot.postBootCommands = lib.mkAfter ''
|
||||
if ! [ -e /var/lib/nixos/did-channel-init ]; then
|
||||
echo "unpacking the NixOS/Nixpkgs sources..."
|
||||
mkdir -p /nix/var/nix/profiles/per-user/root
|
||||
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \
|
||||
-i ${channelSources} --quiet --option build-use-substitutes false \
|
||||
${lib.optionalString config.boot.initrd.systemd.enable "--option sandbox false"} # There's an issue with pivot_root
|
||||
mkdir -m 0700 -p /root/.nix-defexpr
|
||||
ln -s /nix/var/nix/profiles/per-user/root/channels /root/.nix-defexpr/channels
|
||||
mkdir -m 0755 -p /var/lib/nixos
|
||||
touch /var/lib/nixos/did-channel-init
|
||||
fi
|
||||
'';
|
||||
# for nixos-install. We use a systemd service rather than
|
||||
# boot.postBootCommands so that ordering relative to other
|
||||
# early-boot services (e.g. register-nix-paths in QEMU VMs) is
|
||||
# explicit.
|
||||
systemd.services.nix-channel-init = {
|
||||
description = "Initialize NixOS Channel";
|
||||
# Run early so the channel is available before regular services.
|
||||
# nix-env is invoked before nix-daemon.socket is up, so it
|
||||
# accesses the store directly (we are root).
|
||||
unitConfig.DefaultDependencies = false;
|
||||
wantedBy = [ "sysinit.target" ];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"nix-daemon.socket"
|
||||
"nix-daemon.service"
|
||||
];
|
||||
after = [
|
||||
"local-fs.target"
|
||||
# In QEMU VMs the store DB is populated by register-nix-paths.
|
||||
# On real hardware this unit does not exist and the dependency
|
||||
# is silently ignored by systemd.
|
||||
"register-nix-paths.service"
|
||||
];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
if ! [ -e /var/lib/nixos/did-channel-init ]; then
|
||||
echo "unpacking the NixOS/Nixpkgs sources..."
|
||||
mkdir -p /nix/var/nix/profiles/per-user/root
|
||||
${lib.getExe' config.nix.package.out "nix-env"} -p /nix/var/nix/profiles/per-user/root/channels \
|
||||
-i ${channelSources} --quiet --option build-use-substitutes false \
|
||||
${lib.optionalString config.boot.initrd.systemd.enable "--option sandbox false"} # There's an issue with pivot_root
|
||||
mkdir -m 0700 -p /root/.nix-defexpr
|
||||
ln -s /nix/var/nix/profiles/per-user/root/channels /root/.nix-defexpr/channels
|
||||
mkdir -m 0755 -p /var/lib/nixos
|
||||
touch /var/lib/nixos/did-channel-init
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1055,16 +1055,33 @@ in
|
||||
}
|
||||
);
|
||||
|
||||
boot.postBootCommands = ''
|
||||
# After booting, register the contents of the Nix store on the
|
||||
# CD in the Nix database in the tmpfs.
|
||||
${config.nix.package.out}/bin/nix-store --load-db < /nix/store/nix-path-registration
|
||||
systemd.services.register-nix-paths = {
|
||||
description = "Register Nix Store Paths";
|
||||
unitConfig.DefaultDependencies = false;
|
||||
wantedBy = [ "sysinit.target" ];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"nix-daemon.socket"
|
||||
"nix-daemon.service"
|
||||
];
|
||||
after = [ "local-fs.target" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
# After booting, register the contents of the Nix store on the
|
||||
# CD in the Nix database in the tmpfs.
|
||||
${lib.getExe' config.nix.package.out "nix-store"} --load-db < /nix/store/nix-path-registration
|
||||
|
||||
# nixos-rebuild also requires a "system" profile and an
|
||||
# /etc/NIXOS tag.
|
||||
touch /etc/NIXOS
|
||||
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
# nixos-rebuild also requires a "system" profile and an /etc/NIXOS tag.
|
||||
touch /etc/NIXOS
|
||||
${lib.getExe' config.nix.package.out "nix-env"} -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
};
|
||||
|
||||
# Add vfat support to the initrd to enable people to copy the
|
||||
# contents of the CD to a bootable USB stick.
|
||||
|
||||
@@ -166,27 +166,46 @@ with lib;
|
||||
|
||||
boot.loader.timeout = 10;
|
||||
|
||||
systemd.services.register-nix-paths = {
|
||||
description = "Register Nix Store Paths";
|
||||
unitConfig.DefaultDependencies = false;
|
||||
wantedBy = [ "sysinit.target" ];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"nix-daemon.socket"
|
||||
"nix-daemon.service"
|
||||
];
|
||||
after = [ "local-fs.target" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
# After booting, register the contents of the Nix store
|
||||
# in the Nix database in the tmpfs.
|
||||
${lib.getExe' config.nix.package "nix-store"} --load-db < /nix/store/nix-path-registration
|
||||
|
||||
# nixos-rebuild also requires a "system" profile and an /etc/NIXOS tag.
|
||||
touch /etc/NIXOS
|
||||
${lib.getExe' config.nix.package "nix-env"} -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
};
|
||||
|
||||
boot.postBootCommands = ''
|
||||
# After booting, register the contents of the Nix store
|
||||
# in the Nix database in the tmpfs.
|
||||
${config.nix.package}/bin/nix-store --load-db < /nix/store/nix-path-registration
|
||||
|
||||
# nixos-rebuild also requires a "system" profile and an
|
||||
# /etc/NIXOS tag.
|
||||
touch /etc/NIXOS
|
||||
${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
|
||||
# Set password for user nixos if specified on cmdline
|
||||
# Allows using nixos-anywhere in headless environments
|
||||
for o in $(</proc/cmdline); do
|
||||
case "$o" in
|
||||
live.nixos.passwordHash=*)
|
||||
set -- $(IFS==; echo $o)
|
||||
${pkgs.gnugrep}/bin/grep -q "root::" /etc/shadow && ${pkgs.shadow}/bin/usermod -p "$2" root
|
||||
${lib.getExe pkgs.gnugrep} -q "root::" /etc/shadow && ${lib.getExe' pkgs.shadow "usermod"} -p "$2" root
|
||||
;;
|
||||
live.nixos.password=*)
|
||||
set -- $(IFS==; echo $o)
|
||||
${pkgs.gnugrep}/bin/grep -q "root::" /etc/shadow && echo "root:$2" | ${pkgs.shadow}/bin/chpasswd
|
||||
${lib.getExe pkgs.gnugrep} -q "root::" /etc/shadow && echo "root:$2" | ${lib.getExe' pkgs.shadow "chpasswd"}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -377,39 +377,72 @@ in
|
||||
}
|
||||
) { };
|
||||
|
||||
boot.postBootCommands =
|
||||
systemd.services.expand-root-partition = lib.mkIf config.sdImage.expandOnBoot {
|
||||
description = "Grow the root partition and filesystem to fill the SD card";
|
||||
unitConfig = {
|
||||
DefaultDependencies = false;
|
||||
ConditionPathExists = config.sdImage.nixPathRegistrationFile;
|
||||
};
|
||||
wantedBy = [ "sysinit.target" ];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"register-nix-paths.service"
|
||||
];
|
||||
after = [ "local-fs.target" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
# Figure out device names for the boot device and root filesystem.
|
||||
rootPart=$(${lib.getExe' pkgs.util-linux "findmnt"} -n -o SOURCE /)
|
||||
bootDevice=$(${lib.getExe' pkgs.util-linux "lsblk"} -npo PKNAME $rootPart)
|
||||
partNum=$(${lib.getExe' pkgs.util-linux "lsblk"} -npo MAJ:MIN $rootPart | ${lib.getExe pkgs.gawk} -F: '{print $2}')
|
||||
|
||||
# Resize the root partition and the filesystem to fit the disk
|
||||
echo ",+," | ${lib.getExe' pkgs.util-linux "sfdisk"} -N$partNum --no-reread $bootDevice
|
||||
${lib.getExe' pkgs.parted "partprobe"}
|
||||
${lib.getExe' pkgs.e2fsprogs "resize2fs"} $rootPart
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.register-nix-paths =
|
||||
let
|
||||
expandOnBoot = lib.optionalString config.sdImage.expandOnBoot ''
|
||||
# Figure out device names for the boot device and root filesystem.
|
||||
rootPart=$(${pkgs.util-linux}/bin/findmnt -n -o SOURCE /)
|
||||
bootDevice=$(lsblk -npo PKNAME $rootPart)
|
||||
partNum=$(lsblk -npo MAJ:MIN $rootPart | ${pkgs.gawk}/bin/awk -F: '{print $2}')
|
||||
|
||||
# Resize the root partition and the filesystem to fit the disk
|
||||
echo ",+," | sfdisk -N$partNum --no-reread $bootDevice
|
||||
${pkgs.parted}/bin/partprobe
|
||||
${pkgs.e2fsprogs}/bin/resize2fs $rootPart
|
||||
'';
|
||||
nixPathRegistrationFile = config.sdImage.nixPathRegistrationFile;
|
||||
inherit (config.sdImage) nixPathRegistrationFile;
|
||||
in
|
||||
''
|
||||
# On the first boot do some maintenance tasks
|
||||
if [ -f ${nixPathRegistrationFile} ]; then
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
${expandOnBoot}
|
||||
|
||||
# Register the contents of the initial Nix store
|
||||
${config.nix.package.out}/bin/nix-store --load-db < ${nixPathRegistrationFile}
|
||||
{
|
||||
description = "Register Nix Store Paths";
|
||||
unitConfig = {
|
||||
DefaultDependencies = false;
|
||||
ConditionPathExists = nixPathRegistrationFile;
|
||||
};
|
||||
wantedBy = [ "sysinit.target" ];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"nix-daemon.socket"
|
||||
"nix-daemon.service"
|
||||
];
|
||||
after = [ "local-fs.target" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
${lib.getExe' config.nix.package.out "nix-store"} --load-db < ${nixPathRegistrationFile}
|
||||
|
||||
# nixos-rebuild also requires a "system" profile and an /etc/NIXOS tag.
|
||||
touch /etc/NIXOS
|
||||
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
${lib.getExe' config.nix.package.out "nix-env"} -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
|
||||
# Prevents this from running on later boots.
|
||||
rm -f ${nixPathRegistrationFile}
|
||||
fi
|
||||
'';
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
x86_64-linux = "/nix/store/mxn3vxpvk2b42kgd08aw4bn27qhf434w-nix-2.31.3";
|
||||
i686-linux = "/nix/store/b7d35ifww9683l74ydkb0qhrq6lqcisi-nix-2.31.3";
|
||||
aarch64-linux = "/nix/store/ysz7dwmy4zd1zm3wzx5dh9g999xv7pbm-nix-2.31.3";
|
||||
riscv64-linux = "/nix/store/avfv2lqbnphj2ap8y5ihg1l0sqhpjll7-nix-riscv64-unknown-linux-gnu-2.31.3";
|
||||
x86_64-darwin = "/nix/store/s8lcl6nrd5ia7nr4zx9mg720i9f8qm37-nix-2.31.3";
|
||||
aarch64-darwin = "/nix/store/vfjzbcl3kf9jjwh0g2x03cvz2x5hg8py-nix-2.31.3";
|
||||
x86_64-linux = "/nix/store/vals1fs2rl6yn5f8gbqj9mvly4r27shs-nix-2.31.4";
|
||||
i686-linux = "/nix/store/fyrlz8cdzvf5csdh5885wifpxc8ywdii-nix-2.31.4";
|
||||
aarch64-linux = "/nix/store/19p3nc892m7idfg2ngd1614660xqbhnm-nix-2.31.4";
|
||||
riscv64-linux = "/nix/store/x1isvq0xnyrg0l29qk2xlp929cgjsmqy-nix-riscv64-unknown-linux-gnu-2.31.4";
|
||||
x86_64-darwin = "/nix/store/4gqxzd5zkxcq271wi5saml4zd92rdkws-nix-2.31.4";
|
||||
aarch64-darwin = "/nix/store/r3gz609kdqchxcmil7dhbravbq8kwm93-nix-2.31.4";
|
||||
}
|
||||
|
||||
@@ -211,7 +211,6 @@ sub pciCheck {
|
||||
($device eq "0xfd3e" || $device eq "0x7d1d" || $device eq "0xad1d" ||
|
||||
$device eq "0x643e" || $device eq "0xb03e"))
|
||||
{
|
||||
push @imports, "(modulesPath + \"/hardware/cpu/intel-npu.nix\")";
|
||||
push @attrs, "hardware.cpu.intel.npu.enable = true;";
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
./hardware/cpu/amd-ryzen-smu.nix
|
||||
./hardware/cpu/amd-sev.nix
|
||||
./hardware/cpu/intel-microcode.nix
|
||||
./hardware/cpu/intel-npu.nix
|
||||
./hardware/cpu/intel-sgx.nix
|
||||
./hardware/cpu/x86-msr.nix
|
||||
./hardware/decklink.nix
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) writeScript;
|
||||
@@ -45,17 +50,34 @@ in
|
||||
};
|
||||
|
||||
boot.isContainer = true;
|
||||
boot.postBootCommands = ''
|
||||
# After booting, register the contents of the Nix store in the Nix
|
||||
# database.
|
||||
if [ -f /nix-path-registration ]; then
|
||||
${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration &&
|
||||
systemd.services.register-nix-paths = {
|
||||
description = "Register Nix Store Paths";
|
||||
unitConfig = {
|
||||
DefaultDependencies = false;
|
||||
ConditionPathExists = "/nix-path-registration";
|
||||
};
|
||||
wantedBy = [ "sysinit.target" ];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"nix-daemon.socket"
|
||||
"nix-daemon.service"
|
||||
];
|
||||
after = [ "local-fs.target" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
${lib.getExe' config.nix.package.out "nix-store"} --load-db < /nix-path-registration
|
||||
rm /nix-path-registration
|
||||
fi
|
||||
|
||||
# nixos-rebuild also requires a "system" profile
|
||||
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
# nixos-rebuild also requires a "system" profile
|
||||
${lib.getExe' config.nix.package.out "nix-env"} -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
};
|
||||
|
||||
# Install new init script
|
||||
system.activationScripts.installInitScript = ''
|
||||
|
||||
@@ -194,12 +194,7 @@ in
|
||||
systemd.services.undervolt = {
|
||||
description = "Intel Undervolting Service";
|
||||
|
||||
# Apply undervolt on boot, nixos generation switch and resume
|
||||
wantedBy = [
|
||||
"multi-user.target"
|
||||
"post-resume.target"
|
||||
];
|
||||
after = [ "post-resume.target" ]; # Not sure why but it won't work without this
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
@@ -208,6 +203,21 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.undervolt-sleep = {
|
||||
description = "Preserve Intel Undervolting After Sleep";
|
||||
|
||||
wantedBy = [ "sleep.target" ];
|
||||
before = [ "sleep.target" ];
|
||||
|
||||
unitConfig.StopWhenUnneeded = true;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
Restart = "no";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "${cfg.package}/bin/undervolt ${toString cliArgs}";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.undervolt = lib.mkIf cfg.useTimer {
|
||||
description = "Undervolt timer to ensure voltage settings are always applied";
|
||||
partOf = [ "undervolt.service" ];
|
||||
|
||||
@@ -31,17 +31,34 @@
|
||||
|
||||
{
|
||||
boot.isContainer = true;
|
||||
boot.postBootCommands = ''
|
||||
# After booting, register the contents of the Nix store in the Nix
|
||||
# database.
|
||||
if [ -f /nix-path-registration ]; then
|
||||
${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration &&
|
||||
systemd.services.register-nix-paths = {
|
||||
description = "Register Nix Store Paths";
|
||||
unitConfig = {
|
||||
DefaultDependencies = false;
|
||||
ConditionPathExists = "/nix-path-registration";
|
||||
};
|
||||
wantedBy = [ "sysinit.target" ];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"nix-daemon.socket"
|
||||
"nix-daemon.service"
|
||||
];
|
||||
after = [ "local-fs.target" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
${lib.getExe' config.nix.package.out "nix-store"} --load-db < /nix-path-registration
|
||||
rm /nix-path-registration
|
||||
fi
|
||||
|
||||
# nixos-rebuild also requires a "system" profile
|
||||
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
# nixos-rebuild also requires a "system" profile
|
||||
${lib.getExe' config.nix.package.out "nix-env"} -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
};
|
||||
|
||||
# supplement 99-ethernet-default-dhcp which excludes veth
|
||||
systemd.network = lib.mkIf config.networking.useDHCP {
|
||||
|
||||
@@ -76,18 +76,6 @@ with lib;
|
||||
extraCommands = "mkdir -p root etc/systemd/network";
|
||||
};
|
||||
|
||||
boot.postBootCommands = ''
|
||||
# After booting, register the contents of the Nix store in the Nix
|
||||
# database.
|
||||
if [ -f /nix-path-registration ]; then
|
||||
${config.nix.package.out}/bin/nix-store --load-db < /nix-path-registration &&
|
||||
rm /nix-path-registration
|
||||
fi
|
||||
|
||||
# nixos-rebuild also requires a "system" profile
|
||||
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
|
||||
boot = {
|
||||
isContainer = true;
|
||||
loader.initScript.enable = true;
|
||||
@@ -117,6 +105,35 @@ with lib;
|
||||
};
|
||||
|
||||
systemd = {
|
||||
services.register-nix-paths = {
|
||||
description = "Register Nix Store Paths";
|
||||
unitConfig = {
|
||||
DefaultDependencies = false;
|
||||
ConditionPathExists = "/nix-path-registration";
|
||||
};
|
||||
wantedBy = [ "sysinit.target" ];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"nix-daemon.socket"
|
||||
"nix-daemon.service"
|
||||
];
|
||||
after = [ "local-fs.target" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
${lib.getExe' config.nix.package.out "nix-store"} --load-db < /nix-path-registration
|
||||
rm /nix-path-registration
|
||||
|
||||
# nixos-rebuild also requires a "system" profile
|
||||
${lib.getExe' config.nix.package.out "nix-env"} -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
'';
|
||||
};
|
||||
|
||||
mounts = mkIf (!cfg.privileged) [
|
||||
{
|
||||
enable = false;
|
||||
|
||||
@@ -1236,11 +1236,38 @@ in
|
||||
# allow `system.build.toplevel' to be included. (If we had a direct
|
||||
# reference to ${regInfo} here, then we would get a cyclic
|
||||
# dependency.)
|
||||
boot.postBootCommands = lib.mkIf config.nix.enable ''
|
||||
if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then
|
||||
${config.nix.package.out}/bin/nix-store --load-db < ''${BASH_REMATCH[1]}
|
||||
fi
|
||||
'';
|
||||
systemd.services.register-nix-paths = lib.mkIf config.nix.enable {
|
||||
# Run early during boot so the nix store DB is populated before any
|
||||
# service (or test backdoor) tries to use nix commands.
|
||||
# nix-store --load-db writes to the SQLite DB directly, so it does not
|
||||
# need the nix-daemon.
|
||||
unitConfig.DefaultDependencies = false;
|
||||
wantedBy = [
|
||||
"sysinit.target"
|
||||
];
|
||||
before = [
|
||||
"sysinit.target"
|
||||
"shutdown.target"
|
||||
"nix-daemon.socket"
|
||||
"nix-daemon.service"
|
||||
];
|
||||
after = [
|
||||
"local-fs.target"
|
||||
];
|
||||
conflicts = [
|
||||
"shutdown.target"
|
||||
];
|
||||
restartIfChanged = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then
|
||||
${lib.getExe' config.nix.package.out "nix-store"} --load-db < "''${BASH_REMATCH[1]}"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
boot.initrd.availableKernelModules =
|
||||
optional (cfg.qemu.diskInterface == "scsi") "sym53c8xx" ++ optional (cfg.tpm.enable) "tpm_tis";
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "bind";
|
||||
version = "9.20.21";
|
||||
version = "9.20.22";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.isc.org/isc/bind9/${finalAttrs.version}/bind-${finalAttrs.version}.tar.xz";
|
||||
hash = "sha256-FeG1oifSiQ98ToI6bqAY3nDuLzoOhZy/89gqrYWQ3gM=";
|
||||
hash = "sha256-y6kv9jG5SWVfR1/ktUKQ9oYP0AcNOZ8iefZDfA04PsY=";
|
||||
};
|
||||
|
||||
outputs = [
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "dhcpcd";
|
||||
version = "10.3.0";
|
||||
version = "10.3.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "NetworkConfiguration";
|
||||
repo = "dhcpcd";
|
||||
rev = "v${finalAttrs.version}";
|
||||
sha256 = "sha256-XbXZkws1eHvN7OEq7clq2kziwwdk04lNrWbJ9RdHExU=";
|
||||
sha256 = "sha256-L2rR6/qMHWVth2GR3VAoBZmhA6lmCLddbi0VvEG5r70=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "libblake3";
|
||||
version = "1.8.3";
|
||||
version = "1.8.4";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
@@ -21,7 +21,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
owner = "BLAKE3-team";
|
||||
repo = "BLAKE3";
|
||||
tag = finalAttrs.version;
|
||||
hash = "sha256-aj+fru2saqWxDDiV3mNCZZeZIGTxSgta/X50R87hoko=";
|
||||
hash = "sha256-Xz0LH0YpUjDishvXsW6VNK8msFlPXg08wFoSfbgws0g=";
|
||||
};
|
||||
|
||||
sourceRoot = finalAttrs.src.name + "/c";
|
||||
|
||||
@@ -155,73 +155,56 @@ lib.makeExtensible (
|
||||
(
|
||||
{
|
||||
nix_2_28 = commonMeson {
|
||||
version = "2.28.5";
|
||||
hash = "sha256-oIfAHxO+BCtHXJXLHBnsKkGl1Pw+Uuq1PwNxl+lZ+Oc=";
|
||||
version = "2.28.6";
|
||||
hash = "sha256-jg2YDTFt8CY4kMg4ha3UK5C+mQY+Zg67nwNy+CmTk5w=";
|
||||
self_attribute_name = "nix_2_28";
|
||||
patches = patches_common ++ [
|
||||
(fetchpatch2 {
|
||||
name = "nix-2.28-14764-mdbook-0.5-support.patch";
|
||||
url = "https://github.com/NixOS/nix/commit/5a64138e862fe364e751c5c286e8db8c466aaee7.patch?full_index=1";
|
||||
hash = "sha256-vFv/D08x9urtoIE9wiC7Lln4Eq3sgNBwU7TBE1iyrfI=";
|
||||
})
|
||||
lowdown30PatchOld
|
||||
];
|
||||
};
|
||||
|
||||
nixComponents_2_30 =
|
||||
(nixDependencies.callPackage ./modular/packages.nix rec {
|
||||
version = "2.30.3";
|
||||
version = "2.30.4";
|
||||
inherit teams;
|
||||
otherSplices = generateSplicesForNixComponents "nixComponents_2_30";
|
||||
src = fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "nix";
|
||||
tag = version;
|
||||
hash = "sha256-kBuwzMgIE9Tmve0Rpp+q+YCsE2mw9d62M/950ViWeJ0=";
|
||||
hash = "sha256-cJ96IBZCYoX0Tdlo5Q7qDSAKfL6QcUq/4Kr1UplH50E=";
|
||||
};
|
||||
}).appendPatches
|
||||
(
|
||||
patches_common
|
||||
++ [
|
||||
(fetchpatch2 {
|
||||
name = "nix-2.30-14695-mdbook-0.5-support.patch";
|
||||
url = "https://github.com/NixOS/nix/commit/5cbd7856de0a9c13351f98e32a1e26d0854d87fd.patch?full_index=1";
|
||||
hash = "sha256-r2ZF1zBZDKMvyX6X4VsaTMrg0zdjn59Jf6Hqg56r29E=";
|
||||
})
|
||||
lowdown30PatchOld
|
||||
]
|
||||
);
|
||||
(patches_common ++ [ lowdown30PatchOld ]);
|
||||
|
||||
nix_2_30 = addTests "nix_2_30" self.nixComponents_2_30.nix-everything;
|
||||
|
||||
nixComponents_2_31 =
|
||||
(nixDependencies.callPackage ./modular/packages.nix rec {
|
||||
version = "2.31.3";
|
||||
version = "2.31.4";
|
||||
inherit teams;
|
||||
otherSplices = generateSplicesForNixComponents "nixComponents_2_31";
|
||||
src = fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "nix";
|
||||
tag = version;
|
||||
hash = "sha256-oe0YWe8f+pwQH4aYD2XXLW5iEHyXNUddurqJ5CUVCIk=";
|
||||
hash = "sha256-f/haYfcI+9IiYVH+g6cjhF8cK7QWHAFfcPtF+57ujZ0=";
|
||||
};
|
||||
}).appendPatches
|
||||
[
|
||||
lowdown30Patch
|
||||
];
|
||||
[ ];
|
||||
|
||||
nix_2_31 = addTests "nix_2_31" self.nixComponents_2_31.nix-everything;
|
||||
|
||||
nixComponents_2_34 =
|
||||
(nixDependencies.callPackage ./modular/packages.nix rec {
|
||||
version = "2.34.4";
|
||||
version = "2.34.5";
|
||||
inherit teams;
|
||||
otherSplices = generateSplicesForNixComponents "nixComponents_2_34";
|
||||
src = fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "nix";
|
||||
tag = version;
|
||||
hash = "sha256-WPuGqMQGepXoRYjtRudMAMHEoLsIObw2x4sVfho5feA=";
|
||||
hash = "sha256-/S2bnz+TbRFGmNyR31Hfa70uFvJoMM9wYDjpyEw8I+U=";
|
||||
};
|
||||
}).appendPatches
|
||||
patches_common;
|
||||
@@ -230,14 +213,14 @@ lib.makeExtensible (
|
||||
|
||||
nixComponents_git =
|
||||
(nixDependencies.callPackage ./modular/packages.nix rec {
|
||||
version = "2.35pre20260328_${lib.substring 0 8 src.rev}";
|
||||
version = "2.35pre20260407_${lib.substring 0 8 src.rev}";
|
||||
inherit teams;
|
||||
otherSplices = generateSplicesForNixComponents "nixComponents_git";
|
||||
src = fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "nix";
|
||||
rev = "7edcd0a24dc71abb7caa600527833ef540c1bc86";
|
||||
hash = "sha256-fybp46IQmRN7lEUTChc3MTqxmRutmDO4RNSPEQfJQsQ=";
|
||||
rev = "a37db9d249afd61a81ae26368696f60e065d6f61";
|
||||
hash = "sha256-RpfExg4DcWZ/SanVuwVbdijqPylsjvtMrHTQHemE+t8=";
|
||||
};
|
||||
}).appendPatches
|
||||
patches_common;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
nix-main,
|
||||
nix-cmd,
|
||||
|
||||
mimalloc,
|
||||
|
||||
# Configuration Options
|
||||
|
||||
version,
|
||||
@@ -23,6 +25,7 @@ mkMesonExecutable (finalAttrs: {
|
||||
nix-expr
|
||||
nix-main
|
||||
nix-cmd
|
||||
mimalloc
|
||||
];
|
||||
|
||||
mesonFlags = [
|
||||
|
||||
Reference in New Issue
Block a user