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