-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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/proxmox-lxc: allow importing module without activation #267764
nixos/proxmox-lxc: allow importing module without activation #267764
Conversation
@illustris You seem to be the original creator of this module, would you be able to take a look at this? |
This behavior is intentional. This module is modeled similar to the ec2 module and other target-specific modules, and is not meant to be imported by default. Instead of adding an enable option to this module, I recommend adding an option to your own shared base config module. Something like: {config, lib, modulesPath, ...}
{
options.myCustomNamespace.isLXC = lib.mkEnableOption "PVE LXC module"
imports = [
# your other imports
] ++ lib.optionals config.myCustomNamespace.isLXC [
"${modulesPath}/virtualisation/proxmox-lxc.nix"
];
} |
@illustris that is what I first tried, but that only leads to infinite recursion. (oh and the sample above leads to infinite recursion) |
Can you share samples of your code? Something minimal that reproduces the infinite recursion. You can also verify that this is not a module-specific issue by replacing |
The minimal example is basically what ye posted. { modulesPath, config, lib, ...}: {
imports = [] ++ (lib.optional config.silver.lxc [
(modulesPath + "/virtualisation/proxmox-lxc.nix")
]);
options.silver.lxc = lib.mkOption {
type = lib.types.bool;
default = true;
description = lib.mdDoc "Is this a Linux Container?";
};
config = {};
}
We have several servers, most running LXC and some physical. |
You're right, because of how the imports are evaluated, there is no way to make the import optional. I would still recommend you explicitly import the module on the LXC targets, but I see no harm in merging this. |
enable = mkOption { | ||
default = true; | ||
type = types.bool; | ||
description = lib.mdDoc "Whether to enable the ProxmoxLXC."; |
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.
description = lib.mdDoc "Whether to enable the ProxmoxLXC."; | |
description = lib.mdDoc "Whether to enable the Proxmox VE LXC module."; |
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.
Done
c5833be
to
d71f5d4
Compare
Noticed thison my backlog again. From what I can see there should be no conflict with the other more recent changes |
Shouldn't need another review, since this is a relatively simple non-breaking change. I would have merged if I had access. You can try posting this in the "PRs already reviewed" thread on discourse. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/4068 |
…d in mixed machine clusters
d71f5d4
to
c20f3b7
Compare
hey @SuperSandro2000 Sorry fir the ping. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-already-reviewed/2617/1801 |
Should we make a release not entry for this? |
There is no change in the default behaviour of importing the module. This change just gives you the option to not activate the module by setting enable to false. I don't think it needs an entry in the release notes. |
Successfully created backport PR for |
Description of changes
A small patch to allow importing proxmox-lxc without activating it.
We have several servers, some physical, some lxc that share a base config.
We recently accidently imported lxc config into a physical server which caused several issues.
enable
is set to true to not break any exisitng import of this module.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/
)