aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar@gmail.com>2026-09-20 04:15:53 +0530
committerArpit Chakladar <arpitchakladar@gmail.com>2026-09-20 04:15:53 +0530
commitdaea646972aa03ce8e58bff2edaed16bf7fbf9db (patch)
tree0f0ee033422e456b14b3e012ca8b1a490b77de15
parentfb442560064f98ee850c71d78330b9b3abda4774 (diff)
downloadhome-manager-config-daea646972aa03ce8e58bff2edaed16bf7fbf9db.tar.gz
home-manager-config-daea646972aa03ce8e58bff2edaed16bf7fbf9db.zip
chore: added better assertions for options for submodules
Now setting options for submodules requires the submodule to be enabled first.
-rw-r--r--modules/desktop/niri/assertions.nix14
-rw-r--r--modules/desktop/niri/default.nix5
-rw-r--r--modules/file-management/yazi/assertions.nix6
-rw-r--r--modules/media/screen-recording/assertions.nix7
-rw-r--r--modules/networking/usque/assertions.nix10
-rw-r--r--modules/networking/usque/default.nix2
-rw-r--r--modules/office/calcurse/assertions.nix10
-rw-r--r--modules/office/calcurse/default.nix2
-rw-r--r--modules/security/gopass/assertions.nix14
-rw-r--r--modules/security/gopass/default.nix2
-rw-r--r--modules/security/gpg/assertions.nix10
-rw-r--r--modules/security/gpg/default.nix2
-rw-r--r--modules/system/btop/assertions.nix14
-rw-r--r--modules/system/btop/default.nix2
-rw-r--r--modules/web/chromium/assertions.nix10
-rw-r--r--modules/web/chromium/default.nix1
16 files changed, 109 insertions, 2 deletions
diff --git a/modules/desktop/niri/assertions.nix b/modules/desktop/niri/assertions.nix
new file mode 100644
index 0000000..99e9d29
--- /dev/null
+++ b/modules/desktop/niri/assertions.nix
@@ -0,0 +1,14 @@
+# Validates niri hardware GPU options require desktop to be enabled
+{ config, ... }:
+{
+ assertions = [
+ {
+ assertion = !config.desktop.hardware.gpu.nvidia.enable || config.desktop.enable;
+ message = "desktop.hardware.gpu.nvidia.enable requires desktop.enable.";
+ }
+ {
+ assertion = !config.desktop.hardware.gpu.amd.enable || config.desktop.enable;
+ message = "desktop.hardware.gpu.amd.enable requires desktop.enable.";
+ }
+ ];
+}
diff --git a/modules/desktop/niri/default.nix b/modules/desktop/niri/default.nix
index 9b0b160..a5de8d8 100644
--- a/modules/desktop/niri/default.nix
+++ b/modules/desktop/niri/default.nix
@@ -9,7 +9,10 @@ let
base16Colors = import ../../colors/base16 { inherit config lib pkgs; };
in
{
- imports = [ ./keybindings.nix ];
+ imports = [
+ ./keybindings.nix
+ ./assertions.nix
+ ];
options.desktop = {
niri.package = lib.mkOption {
diff --git a/modules/file-management/yazi/assertions.nix b/modules/file-management/yazi/assertions.nix
index 599b8b5..288757d 100644
--- a/modules/file-management/yazi/assertions.nix
+++ b/modules/file-management/yazi/assertions.nix
@@ -1,4 +1,4 @@
-# Validates kitty is enabled for yazi desktop entry
+# Validates yazi dependencies and sub-options
{ config, ... }:
{
assertions = [
@@ -9,5 +9,9 @@
yazi's desktop entry requires kitty as the terminal launcher. Please enable terminal.kitty.
'';
}
+ {
+ assertion = !config.file-management.yazi.file-chooser.enable || config.file-management.yazi.enable;
+ message = "file-management.yazi.file-chooser.enable requires file-management.yazi.enable.";
+ }
];
}
diff --git a/modules/media/screen-recording/assertions.nix b/modules/media/screen-recording/assertions.nix
index 200d5ea..f17cb23 100644
--- a/modules/media/screen-recording/assertions.nix
+++ b/modules/media/screen-recording/assertions.nix
@@ -8,4 +8,11 @@
assertion = !config.media.screen-recording.enable || config.media.wf-recorder.enable;
message = "media.screen-recording is enabled but requires `media.wf-recorder.enable`.";
}
+ {
+ assertion = !config.media.screen-recording.enable || config.terminal.kitty.enable;
+ message = ''
+ media.screen-recording is enabled but terminal.kitty.enable is not.
+ screen-recording's desktop entry requires kitty as the terminal launcher. Please enable terminal.kitty.
+ '';
+ }
]
diff --git a/modules/networking/usque/assertions.nix b/modules/networking/usque/assertions.nix
new file mode 100644
index 0000000..a163dd8
--- /dev/null
+++ b/modules/networking/usque/assertions.nix
@@ -0,0 +1,10 @@
+# Validates usque sub-options require the main module to be enabled
+{ config, ... }:
+{
+ assertions = [
+ {
+ assertion = !config.networking.usque.warp.enable || config.networking.usque.enable;
+ message = "networking.usque.warp.enable requires networking.usque.enable.";
+ }
+ ];
+}
diff --git a/modules/networking/usque/default.nix b/modules/networking/usque/default.nix
index 76d89cd..93ab7e5 100644
--- a/modules/networking/usque/default.nix
+++ b/modules/networking/usque/default.nix
@@ -35,6 +35,8 @@ let
};
in
{
+ imports = [ ./assertions.nix ];
+
options.networking.usque = {
enable = lib.mkEnableOption "Enables usque.";
package = lib.mkOption {
diff --git a/modules/office/calcurse/assertions.nix b/modules/office/calcurse/assertions.nix
new file mode 100644
index 0000000..65805fe
--- /dev/null
+++ b/modules/office/calcurse/assertions.nix
@@ -0,0 +1,10 @@
+# Validates calcurse sub-options require the main module to be enabled
+{ config, ... }:
+{
+ assertions = [
+ {
+ assertion = !config.office.calcurse.sync.enable || config.office.calcurse.enable;
+ message = "office.calcurse.sync.enable requires office.calcurse.enable.";
+ }
+ ];
+}
diff --git a/modules/office/calcurse/default.nix b/modules/office/calcurse/default.nix
index 2b0a19f..90e4699 100644
--- a/modules/office/calcurse/default.nix
+++ b/modules/office/calcurse/default.nix
@@ -41,6 +41,8 @@ let
};
in
{
+ imports = [ ./assertions.nix ];
+
options.office.calcurse = {
enable = lib.mkEnableOption "Enables calcurse.";
package = lib.mkOption {
diff --git a/modules/security/gopass/assertions.nix b/modules/security/gopass/assertions.nix
new file mode 100644
index 0000000..bfecfad
--- /dev/null
+++ b/modules/security/gopass/assertions.nix
@@ -0,0 +1,14 @@
+# Validates gopass sub-options require the main module to be enabled
+{ config, ... }:
+{
+ assertions = [
+ {
+ assertion = !config.security.gopass.sync.enable || config.security.gopass.enable;
+ message = "security.gopass.sync.enable requires security.gopass.enable.";
+ }
+ {
+ assertion = !config.security.gopass.creation-templates.enable || config.security.gopass.enable;
+ message = "security.gopass.creation-templates.enable requires security.gopass.enable.";
+ }
+ ];
+}
diff --git a/modules/security/gopass/default.nix b/modules/security/gopass/default.nix
index aa0a0d6..616baeb 100644
--- a/modules/security/gopass/default.nix
+++ b/modules/security/gopass/default.nix
@@ -6,6 +6,8 @@
...
}:
{
+ imports = [ ./assertions.nix ];
+
options.security.gopass = {
enable = lib.mkEnableOption "Enables gopass.";
package = lib.mkOption {
diff --git a/modules/security/gpg/assertions.nix b/modules/security/gpg/assertions.nix
new file mode 100644
index 0000000..1108e47
--- /dev/null
+++ b/modules/security/gpg/assertions.nix
@@ -0,0 +1,10 @@
+# Validates GPG sub-options require the main module to be enabled
+{ config, ... }:
+{
+ assertions = [
+ {
+ assertion = !config.security.gpg.backup.enable || config.security.gpg.enable;
+ message = "security.gpg.backup.enable requires security.gpg.enable.";
+ }
+ ];
+}
diff --git a/modules/security/gpg/default.nix b/modules/security/gpg/default.nix
index 6956711..3047f59 100644
--- a/modules/security/gpg/default.nix
+++ b/modules/security/gpg/default.nix
@@ -38,6 +38,8 @@ let
};
in
{
+ imports = [ ./assertions.nix ];
+
options.security.gpg = {
enable = lib.mkEnableOption "Enables gpg.";
diff --git a/modules/system/btop/assertions.nix b/modules/system/btop/assertions.nix
new file mode 100644
index 0000000..82cddc3
--- /dev/null
+++ b/modules/system/btop/assertions.nix
@@ -0,0 +1,14 @@
+# Validates btop sub-options require the main module to be enabled
+{ config, ... }:
+{
+ assertions = [
+ {
+ assertion = !config.system.btop.nvidia.enable || config.system.btop.enable;
+ message = "system.btop.nvidia.enable requires system.btop.enable.";
+ }
+ {
+ assertion = !config.system.btop.amd.enable || config.system.btop.enable;
+ message = "system.btop.amd.enable requires system.btop.enable.";
+ }
+ ];
+}
diff --git a/modules/system/btop/default.nix b/modules/system/btop/default.nix
index 40f878f..4f84036 100644
--- a/modules/system/btop/default.nix
+++ b/modules/system/btop/default.nix
@@ -6,6 +6,8 @@
...
}:
{
+ imports = [ ./assertions.nix ];
+
options.system.btop = {
enable = lib.mkEnableOption "Enables btop.";
nvidia.enable = lib.mkEnableOption "Build btop with NVIDIA GPU monitoring support (CUDA).";
diff --git a/modules/web/chromium/assertions.nix b/modules/web/chromium/assertions.nix
new file mode 100644
index 0000000..465ebbd
--- /dev/null
+++ b/modules/web/chromium/assertions.nix
@@ -0,0 +1,10 @@
+# Validates chromium sub-options require the main module to be enabled
+{ config, ... }:
+{
+ assertions = [
+ {
+ assertion = !config.web.chromium.useOpenGL || config.web.chromium.enable;
+ message = "web.chromium.useOpenGL requires web.chromium.enable.";
+ }
+ ];
+}
diff --git a/modules/web/chromium/default.nix b/modules/web/chromium/default.nix
index 7901ad6..1e3608c 100644
--- a/modules/web/chromium/default.nix
+++ b/modules/web/chromium/default.nix
@@ -6,6 +6,7 @@
}:
{
imports = [
+ ./assertions.nix
./browserpass.nix
./extensions
];