aboutsummaryrefslogtreecommitdiff
path: root/.vim/snippets
diff options
context:
space:
mode:
Diffstat (limited to '.vim/snippets')
-rw-r--r--.vim/snippets/module.nix56
-rw-r--r--.vim/snippets/package.nix27
-rw-r--r--.vim/snippets/shell.nix22
-rw-r--r--.vim/snippets/skeleton.awk1
-rw-r--r--.vim/snippets/skeleton.html13
5 files changed, 119 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;
+ };
+ };
+
+ };
+}
diff --git a/.vim/snippets/package.nix b/.vim/snippets/package.nix
new file mode 100644
index 0000000..31cb944
--- /dev/null
+++ b/.vim/snippets/package.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchgit }:
+
+stdenv.mkDerivation rec {
+ pname = "";
+ version = "";
+
+ src = fetchgit {
+ rev = version;
+ url = "";
+ sha256 = "";
+ };
+
+ dontBuild = true;
+
+ installPhase = ''
+ runHook preInstall
+ mkdir "$out"
+ runHook postInstall
+ '';
+
+ meta = {
+ homepage = "";
+ description = "";
+ license = lib.licenses.mit;
+ platforms = lib.platforms.linux;
+ };
+}
diff --git a/.vim/snippets/shell.nix b/.vim/snippets/shell.nix
new file mode 100644
index 0000000..2e58365
--- /dev/null
+++ b/.vim/snippets/shell.nix
@@ -0,0 +1,22 @@
+let
+
+ name = "nix-shell.pure";
+ pkgs = import <nixpkgs> { };
+
+ shell = pkgs.writeShellApplication {
+ inherit name;
+ text = ''
+ /usr/bin/env --ignore-environment /bin/sh -c ${
+ pkgs.writeScript name ''
+ export PS1='\h (${name}) \W \$ '
+ export PATH=${pkgs.lib.strings.makeBinPath [ pkgs.busybox ]}
+ /bin/sh
+ ''
+ };
+ '';
+ };
+
+in pkgs.mkShell {
+ inherit name;
+ shellHook = "exec ${shell}/bin/${shell.name}";
+}
diff --git a/.vim/snippets/skeleton.awk b/.vim/snippets/skeleton.awk
new file mode 100644
index 0000000..528ca97
--- /dev/null
+++ b/.vim/snippets/skeleton.awk
@@ -0,0 +1 @@
+#!/usr/bin/env -S awk -f
diff --git a/.vim/snippets/skeleton.html b/.vim/snippets/skeleton.html
new file mode 100644
index 0000000..8099090
--- /dev/null
+++ b/.vim/snippets/skeleton.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title></title>
+ <meta charset="utf-8" />
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1"
+ />
+ </head>
+ <body>
+ </body>
+</html>