···
cp --remove-destination /etc/resolv.conf "$root/etc/resolv.conf"
116
+
if [ -n "$FLAKE" ] && [ ! -e "/nix/var/nix/profiles/per-container/$INSTANCE/system" ]; then
117
+
# we create the etc/nixos-container config file, then if we utilize the update function, we can then build all the necessary system files for the container
118
+
${lib.getExe nixos-container} update "$INSTANCE"
if [ "$PRIVATE_NETWORK" = 1 ]; then
···
852
+
flake = lib.mkOption {
853
+
type = lib.types.nullOr lib.types.str;
855
+
example = "github:NixOS/nixpkgs/master";
857
+
The Flake URI of the NixOS configuration to use for the container.
858
+
Replaces the option {option}`containers.<name>.path`.
# Removed option. See `checkAssertion` below for the accompanying error message.
pkgs = mkOption { visible = false; };
···
- containers.${name}.config.nixpkgs.pkgs
This only sets the `pkgs` argument used inside the container modules.
885
+
else if options.config.isDefined && (options.flake.value != null) then
887
+
The options 'containers.${name}.path' and 'containers.${name}.flake' cannot both be set.
875
-
builtins.seq checkAssertion mkIf options.config.isDefined
876
-
config.config.system.build.toplevel;
893
+
path = builtins.seq checkAssertion mkMerge [
894
+
(mkIf options.config.isDefined config.config.system.build.toplevel)
895
+
(mkIf (config.flake != null) "/nix/var/nix/profiles/per-container/${name}")
···
unitConfig.RequiresMountsFor = "${stateDirectory}/%i";
932
-
path = [ pkgs.iproute2 ];
root = "${stateDirectory}/%i";
···
nameValuePair "${configurationDirectoryName}/${name}.conf" {
1047
-
SYSTEM_PATH=${cfg.path}
1070
+
${optionalString (cfg.flake == null) ''
1071
+
SYSTEM_PATH=${cfg.path}
1073
+
${optionalString (cfg.flake != null) ''
1074
+
FLAKE=${cfg.flake}
${optionalString cfg.privateNetwork ''
${optionalString (cfg.hostBridge != null) ''