branch: elpa/yasnippet-snippets
commit 03fd78b07bfba5a0c190b96b7cf441219e1d91bd
Author: normalc <norm...@posteo.net>
Commit: GitHub <nore...@github.com>

    Create `nix-ts-mode` sub-directory; Add additional snippets to `nix-mode` 
(#515)
    
    * nix-ts-mode: New snippet directory.
    
    * nix-mode: pkg_mkshell: New snippet
    
    This snippet is designed to quickly write out a `shell.nix` for Nix.
    
    * nix-mode: doCheck: New snippet.
    
    Adds a snippet to add the doCheck attribute to a package derivation
    that uses the current standard: a condition for cross-compilation or
    false.
    
    * nix-mode: passthru_update: New snippet.
    
    This adds a snippet for adding the `passthru.updateScript` attribute
    used in many nixpkgs derivations.
---
 snippets/nix-mode/doCheck         |  8 ++++++++
 snippets/nix-mode/passthru_update |  5 +++++
 snippets/nix-mode/pkgs_mkshell    | 13 +++++++++++++
 snippets/nix-ts-mode/.yas-parents |  1 +
 4 files changed, 27 insertions(+)

diff --git a/snippets/nix-mode/doCheck b/snippets/nix-mode/doCheck
new file mode 100644
index 0000000000..32316f114b
--- /dev/null
+++ b/snippets/nix-mode/doCheck
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: doCheck
+# key: dc
+# --
+doCheck = ${1:$$(yas-auto-next
+                  (yas-choose-value
+                  '("stdenv.buildPlatform.canExecute stdenv.hostPlatform;"
+                    "false;")))}
diff --git a/snippets/nix-mode/passthru_update 
b/snippets/nix-mode/passthru_update
new file mode 100644
index 0000000000..965cd1d00b
--- /dev/null
+++ b/snippets/nix-mode/passthru_update
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: passthru_update
+# key: pu
+# --
+passthru.updateScript = nix-update-script { };
diff --git a/snippets/nix-mode/pkgs_mkshell b/snippets/nix-mode/pkgs_mkshell
new file mode 100644
index 0000000000..4cbb250150
--- /dev/null
+++ b/snippets/nix-mode/pkgs_mkshell
@@ -0,0 +1,13 @@
+# -*- mode: snippet -*-
+# name: pkgs_mkshell
+# key: pms
+# --
+pkgs.${1:$$(yas-auto-next (yas-choose-value '("mkShell" "mkShellNoCC")))} {
+  inputsFrom = [ $3 ];
+
+  packages = [ $2 ];
+
+  shellHook = ''
+  $4
+  '';
+}$0
\ No newline at end of file
diff --git a/snippets/nix-ts-mode/.yas-parents 
b/snippets/nix-ts-mode/.yas-parents
new file mode 100644
index 0000000000..b2ee4f8df3
--- /dev/null
+++ b/snippets/nix-ts-mode/.yas-parents
@@ -0,0 +1 @@
+nix-mode
\ No newline at end of file

Reply via email to