From 1314456be1c96e7c61487a7eee11f80682dafdf1 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Thu, 9 Jul 2026 01:57:05 +0530 Subject: feat: added assertions for automatically validation related options Some programs and their configurations may depend on other programs. For a truly portable configuration users must be able to get appropriate error messages if a options is enabled but its requirements (like a dependent option) is not met. The build crashes for those and keeps the config concise. --- modules/programs/git/assertions.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 modules/programs/git/assertions.nix (limited to 'modules/programs/git/assertions.nix') diff --git a/modules/programs/git/assertions.nix b/modules/programs/git/assertions.nix new file mode 100644 index 0000000..fbe5d3c --- /dev/null +++ b/modules/programs/git/assertions.nix @@ -0,0 +1,13 @@ +{ config, ... }: +{ + assertions = [ + { + assertion = + !config.programs.git.useSSH || (config.programs.git.enable && config.programs.ssh.enable); + message = '' + programs.git.useSSH is enabled but programs.ssh.enable is not. + SSH must be enabled (programs.ssh.enable = true) to use SSH for git. + ''; + } + ]; +} -- cgit v1.2.3