containers: fix for NixOS 26.05
This commit is contained in:
@@ -82,6 +82,7 @@ read -rd '' src <<'EOF' || :
|
|||||||
inherit (nix-bitcoin.inputs) nixpkgs;
|
inherit (nix-bitcoin.inputs) nixpkgs;
|
||||||
# legacyInstallDirs = true;
|
# legacyInstallDirs = true;
|
||||||
config = {
|
config = {
|
||||||
|
imports = [ ../test/lib/extra-container-workaround.nix ];
|
||||||
containers.nb-adhoc = {
|
containers.nb-adhoc = {
|
||||||
# bindMounts."/shared" = { hostPath = "/my/hostpath"; isReadOnly = false; };
|
# bindMounts."/shared" = { hostPath = "/my/hostpath"; isReadOnly = false; };
|
||||||
extra.addressPrefix = "10.200.255";
|
extra.addressPrefix = "10.200.255";
|
||||||
|
|||||||
@@ -31,6 +31,9 @@
|
|||||||
# legacyInstallDirs = true;
|
# legacyInstallDirs = true;
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
# See the file for why this is needed and when it can be removed
|
||||||
|
imports = [ (nix-bitcoin.outPath + "/test/lib/extra-container-workaround.nix") ];
|
||||||
|
|
||||||
containers.mynode = {
|
containers.mynode = {
|
||||||
# Always start container along with the container host
|
# Always start container along with the container host
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ fi
|
|||||||
#
|
#
|
||||||
read -rd '' src <<EOF || true
|
read -rd '' src <<EOF || true
|
||||||
{ pkgs, lib, ... }: {
|
{ pkgs, lib, ... }: {
|
||||||
|
imports = [ $(realpath "${BASH_SOURCE[0]%/*}"/../test/lib/extra-container-workaround.nix) ];
|
||||||
|
|
||||||
containers.demo-node = {
|
containers.demo-node = {
|
||||||
extra.addressPrefix = "10.250.0";
|
extra.addressPrefix = "10.250.0";
|
||||||
extra.enableWAN = true;
|
extra.enableWAN = true;
|
||||||
|
|||||||
@@ -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
@@ -56,12 +56,23 @@ let
|
|||||||
extra-container.lib.buildContainers {
|
extra-container.lib.buildContainers {
|
||||||
inherit system legacyInstallDirs;
|
inherit system legacyInstallDirs;
|
||||||
config = {
|
config = {
|
||||||
|
imports = [ ./extra-container-workaround.nix ];
|
||||||
|
|
||||||
# The container name has a 11 char length limit
|
# The container name has a 11 char length limit
|
||||||
containers.nb-test = { config, ... }: {
|
containers.nb-test = { config, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
{
|
{
|
||||||
config = {
|
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;
|
config = testConfig;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ with lib;
|
|||||||
container = {
|
container = {
|
||||||
# Forwarded to extra-container. For descriptions, see
|
# Forwarded to extra-container. For descriptions, see
|
||||||
# https://github.com/erikarvstedt/extra-container/blob/master/eval-config.nix
|
# 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; };
|
enableWAN = mkOption { default = false; };
|
||||||
firewallAllowHost = mkOption { default = true; };
|
firewallAllowHost = mkOption { default = true; };
|
||||||
exposeLocalhost = mkOption { default = false; };
|
exposeLocalhost = mkOption { default = false; };
|
||||||
|
|||||||
+6
-1
@@ -332,7 +332,12 @@ all() {
|
|||||||
shellcheck
|
shellcheck
|
||||||
examples
|
examples
|
||||||
flake
|
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
|
# An alias for buildTest
|
||||||
|
|||||||
Reference in New Issue
Block a user