feat(file-templates): add Nix flake file template
This commit is contained in:
parent
4fb75bf17b
commit
a0c0c8994c
11
config.org
11
config.org
|
@ -2181,6 +2181,17 @@ This system works well for the most part, but there's a serious issue with its U
|
||||||
|
|
||||||
Now that we have our new-and-improved template registry system, we can add new file templates as we please.
|
Now that we have our new-and-improved template registry system, we can add new file templates as we please.
|
||||||
|
|
||||||
|
**** Nix
|
||||||
|
|
||||||
|
The default Nix file template is for a NixOS module. This is nice when you're writing a module, but most Nix files aren't modules. We'll restrict the default template to only trigger for files inside ~/etc/nixos~, and for there to be no template in other cases. We'll also add a template for flakes.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(set-file-templates!
|
||||||
|
'(nix-mode :remove t)
|
||||||
|
'("/etc/nixos/.*\\.nix$" :mode nix-mode)
|
||||||
|
'("/flake\\.nix$" :trigger "__flake.nix" :mode nix-mode))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Spell Checking
|
** Spell Checking
|
||||||
|
|
||||||
#+call: confpkg("Pkg: ispell")
|
#+call: confpkg("Pkg: ispell")
|
||||||
|
|
17
snippets/nix-mode/__flake.nix
Normal file
17
snippets/nix-mode/__flake.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# contributor: Kiana Sheibani <kiana.a.sheibani@gmail.com>
|
||||||
|
# key: __flake.nix
|
||||||
|
# name: nix flake template
|
||||||
|
# --
|
||||||
|
{
|
||||||
|
description = "${1:Flake description}";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
${2:nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
}${3:flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
}$4
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self$5, ... }:
|
||||||
|
$0
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# contributor: Kiana Sheibani
|
# contributor: Kiana Sheibani <kiana.a.sheibani@gmail.com>
|
||||||
# key: __
|
# key: __
|
||||||
# name: Snippet template
|
# name: Snippet template
|
||||||
# --
|
# --
|
||||||
|
|
Loading…
Reference in a new issue