nvim/snippets/nix.snippets
2025-07-17 11:19:07 +02:00

48 lines
925 B
Text

snippet shell nix-shell
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
$1
];
}
snippet optionalAttrs
lib.attrsets.optionalAttrs $1 $2
snippet deps
let pkgs = import <nixpkgs> {}; in
with pkgs; [ $1 ]
snippet flake
{
description = "Flake utils $1";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.\${system};
in
{
packages = rec {
$1 = pkgs.stdenv.mkDerivation {
name = "$1";
buildInputs = with pkgs; [
$2
];
};
default = $1;
};
}
);
}