1{ config, options, lib, ... }:
2let
3 path = [ "deployment" "autoLuks" ];
4 hasAutoLuksConfig = lib.hasAttrByPath path config && (lib.attrByPath path {} config) != {};
5
6 inherit (config.nixops) enableDeprecatedAutoLuks;
7in {
8 options.nixops.enableDeprecatedAutoLuks = lib.mkEnableOption (lib.mdDoc "Enable the deprecated NixOps AutoLuks module");
9
10 config = {
11 assertions = [
12 {
13 assertion = if hasAutoLuksConfig then hasAutoLuksConfig && enableDeprecatedAutoLuks else true;
14 message = ''
15 ⚠️ !!! WARNING !!! ⚠️
16
17 NixOps autoLuks is deprecated. The feature was never widely used and the maintenance did outgrow the benefit.
18 If you still want to use the module:
19 a) Please raise your voice in the issue tracking usage of the module:
20 https://github.com/NixOS/nixpkgs/issues/62211
21 b) make sure you set the `_netdev` option for each of the file
22 systems referring to block devices provided by the autoLuks module.
23
24 ⚠️ If you do not set the option your system will not boot anymore! ⚠️
25
26 {
27 fileSystems."/secret" = { options = [ "_netdev" ]; };
28 }
29
30 b) set the option >nixops.enableDeprecatedAutoLuks = true< to remove this error.
31
32
33 For more details read through the following resources:
34 - https://github.com/NixOS/nixops/pull/1156
35 - https://github.com/NixOS/nixpkgs/issues/47550
36 - https://github.com/NixOS/nixpkgs/issues/62211
37 - https://github.com/NixOS/nixpkgs/pull/61321
38 '';
39 }
40 ];
41 };
42
43}