containers: fix for NixOS 26.05

This commit is contained in:
Jonas Nick
2026-08-08 06:54:06 +00:00
parent e8328251af
commit 8f7dcb6e2a
7 changed files with 49 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
# FIXME:
# Remove this file, along with the imports in ../../dev/dev.sh,
# ../../examples/container/flake.nix, ../../examples/deploy-container.sh and
# ./make-test.nix, as soon as extra-container declares these options itself
# (https://github.com/erikarvstedt/extra-container/blob/master/eval-config.nix).
#
# extra-container evaluates the container host with a minimal module set to keep
# eval times low. NixOS 26.05 added references to the following options to
# `system/boot/systemd.nix`, which is part of that module set, while their
# declaring modules are not.
#
# The defaults match the ones from the declaring modules. Like extra-container's
# own dummy options, these declarations have no type because they only exist to
# make host eval succeed. They don't affect the resulting container units.
{ lib, pkgs, ... }: {
options = {
environment.variables = lib.mkOption { default = {}; };
i18n.imperativeLocale = lib.mkOption { default = false; };
services.openssh.enable = lib.mkOption { default = false; };
system.nixos-init.package = lib.mkOption { default = pkgs.nixos-init; };
time.timeZone = lib.mkOption { default = null; };
};
}
+12 -1
View File
@@ -56,12 +56,23 @@ let
extra-container.lib.buildContainers {
inherit system legacyInstallDirs;
config = {
imports = [ ./extra-container-workaround.nix ];
# The container name has a 11 char length limit
containers.nb-test = { config, ... }: {
imports = [
{
config = {
extra = config.config.test.container;
extra = {
# Defined here instead of in the container config because NixOS
# 26.05 derives the container's `networking.interfaces` from
# `localAddress`, which extra-container derives from
# `addressPrefix`. Reading it from the container config would
# thus be circular.
addressPrefix = "10.225.255";
inherit (config.config.test.container)
enableWAN firewallAllowHost exposeLocalhost;
};
config = testConfig;
};
}
+1 -1
View File
@@ -31,7 +31,7 @@ with lib;
container = {
# Forwarded to extra-container. For descriptions, see
# https://github.com/erikarvstedt/extra-container/blob/master/eval-config.nix
addressPrefix = mkOption { default = "10.225.255"; };
# `addressPrefix` is not settable here, see ./make-test.nix.
enableWAN = mkOption { default = false; };
firewallAllowHost = mkOption { default = true; };
exposeLocalhost = mkOption { default = false; };
+6 -1
View File
@@ -332,7 +332,12 @@ all() {
shellcheck
examples
flake
nixosSearch
# FIXME: Re-enable when the nixos-search input is usable again.
# It is currently at a rev whose flake-info resolves nixpkgs via
# `builtins.getFlake` instead of NIX_PATH, which breaks our postPatch and
# both runners. See ../dev/known-issues/nixos-search-flake-migration.md.
# Run explicitly with `./run-tests.sh nixosSearch`.
# nixosSearch
}
# An alias for buildTest