Skip to content

Commit fed3f1e

Browse files
committed
feat(nix): add mkShell and flake-{utils,parts}
1 parent 572f566 commit fed3f1e

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

snippets/nix.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,86 @@
8282
],
8383
"description": "Nixpkgs' stdenv.mkDerivation template"
8484
},
85+
"pkgs.mkShell": {
86+
"prefix": "mks",
87+
"body": [
88+
"pkgs.mkShell {",
89+
" packages = [",
90+
" $1",
91+
" ];",
92+
"",
93+
" env = {",
94+
" $2",
95+
" };",
96+
"",
97+
" shellHook = ''",
98+
" $3",
99+
" '';",
100+
"}"
101+
],
102+
"description": "mkShell template"
103+
},
104+
"flake-parts": {
105+
"prefix": "flakeparts",
106+
"body": [
107+
"{",
108+
" description = \"${1:A flake}\";",
109+
"",
110+
" inputs = {",
111+
" nixpkgs.url = \"github:NixOS/nixpkgs/nixos-unstable\";",
112+
" flake-parts.url = \"github:hercules-ci/flake-parts\";",
113+
" systems.url = \"github:nix-systems/default\";",
114+
" };",
115+
"",
116+
" outputs =",
117+
" inputs@{ flake-parts, systems, ... }:",
118+
" flake-parts.lib.mkFlake { inherit inputs; } {",
119+
" imports = [",
120+
" $2",
121+
" ];",
122+
" systems = import systems;",
123+
" perSystem =",
124+
" {",
125+
" config,",
126+
" pkgs,",
127+
" system,",
128+
" ...",
129+
" }:",
130+
" {",
131+
" $3",
132+
" };",
133+
" flake = {",
134+
" $4",
135+
" };",
136+
" };",
137+
"}"
138+
],
139+
"description": "simple flake template with flake-parts"
140+
},
141+
"flake-utils": {
142+
"prefix": "flakeutils",
143+
"body": [
144+
"{",
145+
" description = \"${1:A flake}\";",
146+
"",
147+
" inputs = {",
148+
" nixpkgs.url = \"github:NixOS/nixpkgs/nixos-unstable\";",
149+
" systems.url = \"github:nix-systems/default\";",
150+
" flake-utils = {",
151+
" url = \"github:numtide/flake-utils\";",
152+
" inputs.systems.follows = \"systems\";",
153+
" };",
154+
" $2",
155+
" };",
156+
"",
157+
" outputs = inputs @ { self, nixpkgs, flake-utils, ... }: ",
158+
" flake-utils.lib.eachDefaultSystem (system: {",
159+
" $3",
160+
" });",
161+
"}"
162+
],
163+
"description": "simple flake template with flake-utils"
164+
},
85165
"meta": {
86166
"prefix": "meta",
87167
"body": [

0 commit comments

Comments
 (0)