about summary refs log tree commit diff
path: root/nixos/modules/misc
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2019-05-28 18:33:28 +0200
committerAndreas Rammhold <andreas@rammhold.de>2019-06-03 15:05:23 +0200
commit9077623324d9366041bb6628be1a5cffb7bc815d (patch)
tree480f1b3f709c37edef2c9db1be0d49510a8c8394 /nixos/modules/misc
parent0f93834c5e6e1e7489ab4be55c38cb1d4b9d325f (diff)
downloadnixlib-9077623324d9366041bb6628be1a5cffb7bc815d.tar
nixlib-9077623324d9366041bb6628be1a5cffb7bc815d.tar.gz
nixlib-9077623324d9366041bb6628be1a5cffb7bc815d.tar.bz2
nixlib-9077623324d9366041bb6628be1a5cffb7bc815d.tar.lz
nixlib-9077623324d9366041bb6628be1a5cffb7bc815d.tar.xz
nixlib-9077623324d9366041bb6628be1a5cffb7bc815d.tar.zst
nixlib-9077623324d9366041bb6628be1a5cffb7bc815d.zip
nixos/misc: warn when someone is using the nixops autoLuks module
The autoLuks module is not really compatible with the updated systemd
version anymore. We started dropping NixOS specific patches that caused
unwanted side effects that we had to work around otherwise.

This change points users towards the relevant PR and spits out a bit of
information on how to deal with the situation.
Diffstat (limited to 'nixos/modules/misc')
-rw-r--r--nixos/modules/misc/nixops-autoluks.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/nixos/modules/misc/nixops-autoluks.nix b/nixos/modules/misc/nixops-autoluks.nix
new file mode 100644
index 000000000000..2153c6f975ad
--- /dev/null
+++ b/nixos/modules/misc/nixops-autoluks.nix
@@ -0,0 +1,44 @@
+{ config, options, lib, ... }:
+let
+  path = [ "deployment" "autoLuks" ];
+  hasAutoLuksOption = lib.hasAttrByPath path options;
+  hasAutoLuksConfig = lib.hasAttrByPath path config && (lib.attrByPath path {} config) != {};
+
+  inherit (config.nixops) enableDeprecatedAutoLuks;
+in {
+  options.nixops.enableDeprecatedAutoLuks = lib.mkEnableOption "Enable the deprecated NixOps AutoLuks module";
+
+  config = {
+    assertions = [
+      {
+        assertion = if hasAutoLuksConfig then hasAutoLuksConfig && enableDeprecatedAutoLuks else true;
+        message = ''
+          ⚠️  !!! WARNING !!! ⚠️
+
+            NixOps autoLuks is deprecated. The feature was never widely used and the maintenance did outgrow the benefit.
+            If you still want to use the module:
+              a) Please raise your voice in the issue tracking usage of the module:
+                 https://github.com/NixOS/nixpkgs/issues/62211
+              b) make sure you set the `_netdev` option for each of the file
+                 systems referring to block devices provided by the autoLuks module.
+
+                 ⚠️ If you do not set the option your system will not boot anymore! ⚠️
+
+                  {
+                    fileSystems."/secret" = { options = [ "_netdev" ]; };
+                  }
+
+              b) set the option >nixops.enableDeprecatedAutoLuks = true< to remove this error.
+
+
+            For more details read through the following resources:
+              - https://github.com/NixOS/nixops/pull/1156
+              - https://github.com/NixOS/nixpkgs/issues/47550
+              - https://github.com/NixOS/nixpkgs/issues/62211
+              - https://github.com/NixOS/nixpkgs/pull/61321
+        '';
+      }
+    ];
+  };
+
+}