-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos: Cut off virtualisation.vmVariant.virtualisation.vmVariant #390717
Conversation
f1d462b
to
656c2f4
Compare
@ofborg test nixos-rebuild-specialisations nixos-rebuild-specialisations-ng |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The following tests were successful to my expectation:
nix-build $(nix-instantiate --expr 'let inherit ((import ./nixos {
configuration = { modulesPath, ... }: {
imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" ];
config = {
virtualisation.vmVariant.networking.hostName = "vm";
};
};
}).config.system.build) toplevel vm vmWithBootLoader; in [ toplevel vm vmWithBootLoader ]')
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/sfr7grrdh5v4y978q492qvphvgd828d4-nixos-system-nixos-25.05pre-git
/nix/store/ihxssrwczgqnrr2x69illciai2d3j8ws-nixos-vm
/nix/store/zps0bk3wk24nx474ddm8sfw8cqp4ax99-nixos-vm
nix-instantiate --eval --strict --expr 'let inherit (import ./nixos {
configuration = { modulesPath, ... }: {
config = {
virtualisation.vmVariant.networking.hostName = "vm";
};
};
}) config; in [ config.networking.hostName config.virtualisation.vmVariant.networking.hostName ]'
[ "nixos" "vm" ]
nix-instantiate --eval --strict --expr 'let inherit (import ./nixos {
configuration = { modulesPath, ... }: {
config = {
virtualisation.vmVariant.networking.hostName = "vm";
};
};
}) config; in config.virtualisation.vmVariant.virtualisation.vmVariant'
error: virtualisation.vmVariant*.virtualisation.vmVariant is not supported
PS. I rebased onto master before testing.
@@ -2,6 +2,7 @@ | |||
config, | |||
extendModules, | |||
lib, | |||
specialArgs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now unused! :-)
nixos/tests/all-tests.nix
Outdated
nixos-rebuild-build-vm-image-script = callTest { | ||
test = | ||
(pkgs.nixos { nixpkgs.hostPlatform = pkgs.stdenv.hostPlatform; }) | ||
.config.virtualisation.vmVariant.system.build.vm; | ||
}; | ||
nixos-rebuild-build-vm-with-bootloader-image-script = callTest { | ||
test = | ||
(pkgs.nixos { nixpkgs.hostPlatform = pkgs.stdenv.hostPlatform; }) | ||
.config.virtualisation.vmVariantWithBootLoader.system.build.vmWithBootLoader; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since #391021 has been merged these seem extraneous.
fd778ef
to
5b9533d
Compare
This produced an unnecessarily infinitely deep config tree. The "cut off" option can be written to, but not read from. Being written to is important, because it allows users to conveniently define vmVariant config without having to check isVmVariant. There's a small chance that someone *reads* from vmVariant config in their normal config, and for them it will not be possible to evaluate with `nixos-rebuild build-vm` anymore. If this is a problem, we could perhaps make the vmVariant root appear instead of the `throw` error. This could also be done using mkOption apply.
5b9533d
to
9aab8b8
Compare
@ofborg test vm-variant |
This produced an unnecessarily infinitely deep config tree, which is troublesome for configuration diffing.
The "cut off" option can be written to, but not read from. Being written to is important, because it allows users to conveniently define vmVariant config without having to check isVmVariant.
There's a small chance that someone reads from vmVariant config in their normal config, and for them it will not be possible to evaluate with
nixos-rebuild build-vm
anymore.If this is a problem, we could perhaps make the vmVariant root appear instead of the mkSinkUndeclaredOptions error. This could be done using mkOption apply.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.