This commit is contained in:
2025-12-25 15:01:04 -07:00
parent 621a9d410b
commit ef69b83a6a
10 changed files with 183 additions and 0 deletions

View File

@@ -1,2 +1,5 @@
# flakes
A collection of flakes for various projects.
## Usage
nix flake init -t <path-to-flakes-repo>#<template-name>

1
bun/.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

35
bun/flake.nix Normal file
View File

@@ -0,0 +1,35 @@
{
description = "Bun dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
};
outputs = { self, nixpkgs }:
let
allSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
bun
];
shellHook = ''
echo "<bun dev shell>"
echo "Bun version: $(bun --version)"
'';
};
});
};
}

26
flake.nix Normal file
View File

@@ -0,0 +1,26 @@
{
description = "A collection of flake templates";
outputs = { self }: {
templates = {
node-pnpm = {
path = ./node-pnpm;
description = "Node.js with pnpm development environment";
};
go = {
path = ./go;
description = "Go development environment";
};
rust = {
path = ./rust;
description = "Rust development environment";
};
bun = {
path = ./bun;
description = "Bun development environment";
};
};
defaultTemplate = self.templates.node-pnpm;
};
}

1
go/.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

38
go/flake.nix Normal file
View File

@@ -0,0 +1,38 @@
{
description = "Go dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
};
outputs = { self, nixpkgs }:
let
allSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
go
gopls
gotools
go-tools
];
shellHook = ''
echo "<go dev shell>"
echo "Go version: $(go version)"
'';
};
});
};
}

1
node-pnpm/.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

37
node-pnpm/flake.nix Normal file
View File

@@ -0,0 +1,37 @@
{
description = "Node.js with pnpm dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
};
outputs = { self, nixpkgs }:
let
allSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
nodejs_20
nodePackages.pnpm
];
shellHook = ''
echo "<node-pnpm dev shell>"
echo "Node version: $(node --version)"
echo "pnpm version: $(pnpm --version)"
'';
};
});
};
}

1
rust/.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

40
rust/flake.nix Normal file
View File

@@ -0,0 +1,40 @@
{
description = "Rust dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
};
outputs = { self, nixpkgs }:
let
allSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
cargo
rustc
rustfmt
rust-analyzer
clippy
];
shellHook = ''
echo "<rust dev shell>"
echo "Cargo version: $(cargo --version)"
echo "Rustc version: $(rustc --version)"
'';
};
});
};
}