From eeb2c0521205fa9b967d64495039f03665ee7e22 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Tue, 13 May 2025 17:46:54 +0200 Subject: [PATCH] feat(nix): add `mkShell` and `flake-{utils,parts}` --- snippets/nix.json | 80 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/snippets/nix.json b/snippets/nix.json index 8cb7cce2..f7f41f38 100644 --- a/snippets/nix.json +++ b/snippets/nix.json @@ -82,6 +82,86 @@ ], "description": "Nixpkgs' stdenv.mkDerivation template" }, + "pkgs.mkShell": { + "prefix": "mks", + "body": [ + "pkgs.mkShell {", + " shellHook = ''", + " $1", + " '';", + "", + " env = {", + " $2", + " };", + "", + " packages = [", + " $3", + " ];", + "}" + ], + "description": "mkShell template" + }, + "flake-parts": { + "prefix": "flakeparts", + "body": [ + "{", + " description = \"${1:A flake}\";", + "", + " inputs = {", + " nixpkgs.url = \"github:NixOS/nixpkgs/nixos-unstable\";", + " flake-parts.url = \"github:hercules-ci/flake-parts\";", + " };", + "", + " outputs =", + " inputs@{ flake-parts, ... }:", + " flake-parts.lib.mkFlake { inherit inputs; } {", + " imports = [", + " $2", + " ];", + " systems = [", + " \"x86_64-linux\"", + " \"aarch64-linux\"", + " \"aarch64-darwin\"", + " \"x86_64-darwin\"", + " ];", + " perSystem =", + " {", + " config,", + " pkgs,", + " system,", + " ...", + " }:", + " {", + " $3", + " };", + " flake = {", + " $4", + " };", + " };", + "}" + ], + "description": "simple flake template with flake-parts" + }, + "flake-utils": { + "prefix": "flakeutils", + "body": [ + "{", + " description = \"${1:A flake}\";", + "", + " inputs = {", + " nixpkgs.url = \"github:NixOS/nixpkgs/nixos-unstable\";", + " flake-utils.url = \"github:numtide/flake-utils\";", + " $2", + " };", + "", + " outputs = inputs @ { self, nixpkgs, flake-utils, ... }: ", + " flake-utils.lib.eachDefaultSystem (system: {", + " $3", + " });", + "}" + ], + "description": "simple flake template with flake-utils" + }, "meta": { "prefix": "meta", "body": [