aboutsummaryrefslogtreecommitdiff
path: root/.vim/snippets/module.nix
diff options
context:
space:
mode:
Diffstat (limited to '.vim/snippets/module.nix')
-rw-r--r--.vim/snippets/module.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/.vim/snippets/module.nix b/.vim/snippets/module.nix
new file mode 100644
index 0000000..bc9d52e
--- /dev/null
+++ b/.vim/snippets/module.nix
@@ -0,0 +1,56 @@
+{ pkgs, lib, config, ... }:
+
+let
+
+ service = "";
+ cfg = config.services.${service};
+ settings = pkgs.formats.json { };
+
+in {
+
+ options.services.${service} = {
+
+ enable = lib.mkOption {
+ type = lib.types.bool;
+ default = false;
+ };
+
+ user = lib.mkOption {
+ type = lib.types.str;
+ default = service;
+ };
+
+ group = lib.mkOption {
+ type = lib.types.str;
+ default = service;
+ };
+
+ directory = lib.mkOption {
+ type = lib.types.str;
+ default = "/var/empty";
+ };
+
+ settings = lib.mkOption {
+ type = settings.type;
+ default = { };
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+
+ services.${service}.settings = { };
+
+ users = {
+ groups.${cfg.user} = { gid = 9999; };
+ users.${cfg.group} = {
+ uid = 9999;
+ shell = pkgs.shadow;
+ home = cfg.directory;
+ group = cfg.group;
+ createHome = true;
+ isSystemUser = true;
+ };
+ };
+
+ };
+}