From 7ee66ea37608e7877d74d8a62ba5238cdf8d32cd Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 2 Apr 2023 19:58:13 +0300 Subject: [PATCH] feat: assert on broken/unsupported config structures --- lib/assertions.nix | 16 ++++++++++++++++ lib/default.nix | 4 ++++ lib/module/default.nix | 9 +++++++++ 3 files changed, 29 insertions(+) create mode 100644 lib/assertions.nix diff --git a/lib/assertions.nix b/lib/assertions.nix new file mode 100644 index 00000000..49ea8acd --- /dev/null +++ b/lib/assertions.nix @@ -0,0 +1,16 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; let + cfg = config.vim; +in { + assertions = mkMerge [ + { + assertion = cfg.kommentary.enable; + message = "Kommentary has been deprecated in favor"; + } + ]; +} diff --git a/lib/default.nix b/lib/default.nix index 873f31bc..bf12f0da 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -2,4 +2,8 @@ dag = import ./dag.nix {inherit lib;}; booleans = import ./booleans.nix {inherit lib;}; types = import ./types {inherit lib;}; + + imports = [ + ./assertions.nix + ]; } diff --git a/lib/module/default.nix b/lib/module/default.nix index 7689aef8..77e47329 100644 --- a/lib/module/default.nix +++ b/lib/module/default.nix @@ -45,5 +45,14 @@ in { config = mkIf cfg.enable { home.packages = [set.neovim]; + + assertions = mkMerge [ + mkIf + (config.programs.neovim-flake.enable) + { + assertion = !config.programs.neovim.enable; + message = "You cannot use neovim-flake together with vanilla neovim."; + } + ]; }; }