about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2022-10-26 17:21:07 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2022-11-09 23:47:37 +0100
commit5452a260774ac78d71232896aa69734ed1e9607a (patch)
tree9bc6a19edd5364c123a7ef3da72f661df57c8898 /nixos
parentf26896669bc5a92d879f7d34c9458e8c44635ab5 (diff)
nixos/lvm: replace boot.isContainer with services.lvm.enable
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/tasks/lvm.nix6
-rw-r--r--nixos/modules/virtualisation/container-config.nix3
2 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/tasks/lvm.nix b/nixos/modules/tasks/lvm.nix
index 760133fafa29c..a14f26c02e48f 100644
--- a/nixos/modules/tasks/lvm.nix
+++ b/nixos/modules/tasks/lvm.nix
@@ -5,6 +5,10 @@ let
   cfg = config.services.lvm;
 in {
   options.services.lvm = {
+    enable = mkEnableOption (lib.mdDoc "lvm2") // {
+      default = true;
+    };
+
     package = mkOption {
       type = types.package;
       default = pkgs.lvm2;
@@ -30,7 +34,7 @@ in {
       # minimal configuration file to make lvmconfig/lvm2-activation-generator happy
       environment.etc."lvm/lvm.conf".text = "config {}";
     })
-    (mkIf (!config.boot.isContainer) {
+    (mkIf cfg.enable {
       systemd.tmpfiles.packages = [ cfg.package.out ];
       environment.systemPackages = [ cfg.package ];
       systemd.packages = [ cfg.package ];
diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix
index a7f5044fb9cdb..b0df6f1a7c9f6 100644
--- a/nixos/modules/virtualisation/container-config.nix
+++ b/nixos/modules/virtualisation/container-config.nix
@@ -19,6 +19,9 @@ with lib;
     # containers do not need to setup devices
     services.udev.enable = false;
 
+    # containers normally do not need to manage logical volumes
+    services.lvm.enable = lib.mkDefault false;
+
     # Shut up warnings about not having a boot loader.
     system.build.installBootLoader = lib.mkDefault "${pkgs.coreutils}/bin/true";