|
14 | 14 | inherit lib;
|
15 | 15 | };
|
16 | 16 |
|
| 17 | + hasDiskoFile = diskoFile != null; |
| 18 | + |
17 | 19 | diskoAttr =
|
18 |
| - if noDeps then |
19 |
| - { |
20 |
| - destroy = "_cliDestroyNoDeps"; |
21 |
| - format = "_cliFormatNoDeps"; |
22 |
| - mount = "_cliMountNoDeps"; |
| 20 | + (if noDeps then |
| 21 | + (if hasDiskoFile then |
| 22 | + { |
| 23 | + destroy = "_cliDestroyNoDeps"; |
| 24 | + format = "_cliFormatNoDeps"; |
| 25 | + mount = "_cliMountNoDeps"; |
23 | 26 |
|
24 |
| - "format,mount" = "_cliFormatMountNoDeps"; |
25 |
| - "destroy,format,mount" = "_cliDestroyFormatMountNoDeps"; |
| 27 | + "format,mount" = "_cliFormatMountNoDeps"; |
| 28 | + "destroy,format,mount" = "_cliDestroyFormatMountNoDeps"; |
| 29 | + } |
| 30 | + else |
| 31 | + { |
| 32 | + destroy = "destroyNoDeps"; |
| 33 | + format = "formatNoDeps"; |
| 34 | + mount = "mountNoDeps"; |
26 | 35 |
|
| 36 | + "format,mount" = "formatMountNoDeps"; |
| 37 | + "destroy,format,mount" = "destroyFormatMountNoDeps"; |
| 38 | + }) // { |
27 | 39 | # legacy aliases
|
28 | 40 | disko = "diskoScriptNoDeps";
|
29 | 41 | create = "createScriptNoDeps";
|
30 | 42 | zap_create_mount = "diskoScriptNoDeps";
|
31 |
| - }.${mode} |
| 43 | + } |
32 | 44 | else
|
33 |
| - { |
34 |
| - destroy = "_cliDestroy"; |
35 |
| - format = "_cliFormat"; |
36 |
| - mount = "_cliMount"; |
| 45 | + (if hasDiskoFile then |
| 46 | + { |
| 47 | + destroy = "_cliDestroy"; |
| 48 | + format = "_cliFormat"; |
| 49 | + mount = "_cliMount"; |
37 | 50 |
|
38 |
| - "format,mount" = "_cliFormatMount"; |
39 |
| - "destroy,format,mount" = "_cliDestroyFormatMount"; |
| 51 | + "format,mount" = "_cliFormatMount"; |
| 52 | + "destroy,format,mount" = "_cliDestroyFormatMount"; |
| 53 | + } |
| 54 | + else |
| 55 | + { |
| 56 | + destroy = "destroy"; |
| 57 | + format = "format"; |
| 58 | + mount = "munt"; |
40 | 59 |
|
| 60 | + "format,mount" = "formatMount"; |
| 61 | + "destroy,format,mount" = "destroyFormatMount"; |
| 62 | + }) // { |
41 | 63 | # legacy aliases
|
42 | 64 | disko = "diskoScript";
|
43 | 65 | create = "createScript";
|
44 | 66 | zap_create_mount = "diskoScript";
|
45 |
| - }.${mode}; |
| 67 | + } |
| 68 | + ).${mode}; |
46 | 69 |
|
47 | 70 | hasDiskoConfigFlake =
|
48 |
| - diskoFile != null || lib.hasAttrByPath [ "diskoConfigurations" flakeAttr ] (builtins.getFlake flake); |
| 71 | + hasDiskoFile || lib.hasAttrByPath [ "diskoConfigurations" flakeAttr ] (builtins.getFlake flake); |
49 | 72 |
|
50 | 73 | hasDiskoModuleFlake =
|
51 | 74 | lib.hasAttrByPath [ "nixosConfigurations" flakeAttr "config" "disko" "devices" ] (builtins.getFlake flake);
|
52 | 75 |
|
| 76 | + |
53 | 77 | diskFormat =
|
54 | 78 | let
|
55 | 79 | diskoConfig =
|
56 |
| - if diskoFile != null then |
| 80 | + if hasDiskoFile then |
57 | 81 | import diskoFile
|
58 | 82 | else
|
59 | 83 | (builtins.getFlake flake).diskoConfigurations.${flakeAttr};
|
|
0 commit comments