feat(nvf/snippets): add snippet for nix module

This commit is contained in:
Mohammad Rafiq 2025-05-06 14:58:36 +08:00
parent 82ee855254
commit 3e92ace989
No known key found for this signature in database

View file

@ -6,3 +6,29 @@ snippet option
example = "$3";
description = "$4";
};
snippet fn An empty function that takes an attribute set as a parameter.
{ $1 }:
{
$2
}
snippet module An empty module.
{ config, lib, ... }:
let
moduleName = "$2";
cfg = config.${${moduleName}};
in
{
imports = [];
options.${${moduleName}} = {
enable = lib.mkEnableOption "Enable ${${moduleName}}";
};
configs = lib.mkIf cfg.enable (lib.mkMerge [
{
$3
}
]);
}