1
0
Fork 0
nix-config/modules/neovim/snippets/nix.json

98 lines
2.2 KiB
JSON

{
"ifelse": {
"prefix": "if",
"body": [
"if $1 then",
" $2",
"else$0"
],
"description": "if-else block"
},
"letin": {
"prefix": "let",
"body": [
"let",
" $1",
"in $0"
],
"description": "let-in block"
},
"hash": {
"prefix": "hash",
"body": "\"${1:sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=}\";",
"description": "Empty hash"
},
"fetchFrom": {
"prefix": "fetchFrom",
"body": [
"fetchFrom${1|GitHub,GitLab,Gitea,Gitiles,BitBucket,Savannah,RepoOrCz,SourceHut|} {",
" owner = \"$2\";",
" repo = \"$3\";",
" rev = \"${4:v\\${version\\}}\";",
" hash = \"${5:sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=}\";",
"};"
],
"description": "fetchFromGitHub, or any other common fetcher from Nixpkgs"
},
"fetchurl": {
"prefix": "fetchurl",
"body": [
"fetchurl {",
" url = \"$1\";",
" hash = \"${2:sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=}\";",
"};"
],
"description": "fetchurl with default empty hash"
},
"package-arguments": {
"prefix": "pkg",
"body": [
"{ lib",
", ${1:stdenv}",
", $2",
"}:",
"",
"$0"
],
"description": "Package arguments, starting with { lib"
},
"stdenv.mkDerivation": {
"prefix": "mkd",
"body": [
"stdenv.mkDerivation (finalAttrs: {",
" pname = \"$1\";",
" version = \"$2\";",
"",
" src = $3",
"",
" nativeBuildInputs = [",
" $4",
" ];",
" buildInputs = [",
" $0",
" ];",
"",
" meta = {",
" description = \"$5\";",
" homepage = \"$6\";",
" license = lib.licenses.$7;",
" maintainers = with lib.maintainers; [ $8 ];",
" };",
"})"
],
"description": "Nixpkgs' stdenv.mkDerivation template"
},
"meta": {
"prefix": "meta",
"body": [
"meta = {",
" description = \"$1\";",
" homepage = \"$2\";",
" license = lib.licenses.$3;",
" maintainers = with lib.maintainers; [ $0 ];",
"};"
],
"description": "Nixpkgs' minimal meta attribute set"
}
}