Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake . --impure
1 change: 1 addition & 0 deletions apps/cli/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,6 @@ export const ADDON_COMPATIBILITY = {
fumadocs: [],
opentui: [],
wxt: [],
"nix-flake": [],
none: [],
} as const;
2 changes: 2 additions & 0 deletions apps/cli/src/helpers/core/template-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export async function processAndCopyFiles(
relativeDestPath = path.join(path.dirname(relativeDestPath), ".gitignore");
} else if (basename === "_npmrc") {
relativeDestPath = path.join(path.dirname(relativeDestPath), ".npmrc");
} else if (basename === "_envrc") {
relativeDestPath = path.join(path.dirname(relativeDestPath), ".envrc");
}

const destPath = path.join(destDir, relativeDestPath);
Expand Down
6 changes: 5 additions & 1 deletion apps/cli/src/prompts/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ function getAddonDisplay(addon: Addons): { label: string; hint: string } {
label = "WXT";
hint = "Build browser extensions";
break;
case "nix-flake":
label = "Nix Flake";
hint = "Reproducible dev environment with Nix";
break;
default:
label = addon;
hint = `Add ${addon}`;
Expand All @@ -74,7 +78,7 @@ function getAddonDisplay(addon: Addons): { label: string; hint: string } {
const ADDON_GROUPS = {
Documentation: ["starlight", "fumadocs"],
Linting: ["biome", "oxlint", "ultracite"],
Other: ["ruler", "pwa", "tauri", "husky", "opentui", "wxt", "turborepo"],
Other: ["ruler", "pwa", "tauri", "husky", "opentui", "wxt", "turborepo", "nix-flake"],
};

export async function getAddonsChoice(addons?: Addons[], frontends?: Frontend[], auth?: Auth) {
Expand Down
2 changes: 2 additions & 0 deletions apps/cli/templates/addons/nix-flake/_envrc.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake

48 changes: 48 additions & 0 deletions apps/cli/templates/addons/nix-flake/flake.nix.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
\{
description = "\{{projectName}} devshell";

inputs = \{
nixpkgs = \{
url = "github:NixOS/nixpkgs/nixos-unstable";
};
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Align nixpkgs input with root flake for consistency and reproducibility.

The template uses nixos-unstable while the root flake.nix pins to nixos-25.11. This inconsistency can lead to:

  • Reproducibility issues across environments
  • Unexpected breaking changes when unstable updates
  • Different behavior between the template-generated projects and the root configuration

Consider aligning with the root flake's approach by using a stable release branch.

🔎 Proposed fix
   inputs = \{
     nixpkgs = \{
-      url = "github:NixOS/nixpkgs/nixos-unstable";
+      url = "github:NixOS/nixpkgs/nixos-25.11";
     };
   };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
inputs = \{
nixpkgs = \{
url = "github:NixOS/nixpkgs/nixos-unstable";
};
};
inputs = \{
nixpkgs = \{
url = "github:NixOS/nixpkgs/nixos-25.11";
};
};
🤖 Prompt for AI Agents
In apps/cli/templates/addons/nix-flake/flake.nix.hbs around lines 4-8, the
nixpkgs input is pinned to "nixos-unstable", which diverges from the root
flake's stable pin (nixos-25.11); update the template to use the same stable
release branch or the exact pin used by the root flake (e.g., change the url to
match "github:NixOS/nixpkgs/nixos-25.11" or wire the template to read the root
flake's pinned ref) so generated projects use the same nixpkgs version for
reproducibility and consistency.


outputs = \{ self, nixpkgs }:
let
mkShellFor = system:
let
pkgs = nixpkgs.legacyPackages.$\{system};
in
pkgs.mkShell \{
packages = [
{{#if (eq runtime "bun")}}
pkgs.bun
{{else if (eq runtime "node")}}
pkgs.nodejs_22
{{/if}}
{{#if (eq dbSetup "docker")}}
pkgs.docker-compose
{{/if}}
];

shellHook = ''
{{#if (eq runtime "bun")}}
if [ -n "$PS1" ]; then
echo "bun: $(bun --version)"
fi
{{else if (eq runtime "node")}}
if [ -n "$PS1" ]; then
echo "node: $(node --version)"
fi
{{/if}}
'';
};
in
\{
devShells.x86_64-linux.default = mkShellFor "x86_64-linux";
devShells.aarch64-linux.default = mkShellFor "aarch64-linux";
devShells.x86_64-darwin.default = mkShellFor "x86_64-darwin";
devShells.aarch64-darwin.default = mkShellFor "aarch64-darwin";
};
}

3 changes: 2 additions & 1 deletion apps/cli/test/addons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { expectError, expectSuccess, runTRPCTest, type TestConfig } from "./test

describe("Addon Configurations", () => {
describe("Universal Addons (no frontend restrictions)", () => {
const universalAddons = ["biome", "husky", "turborepo", "oxlint"];
const universalAddons = ["biome", "husky", "turborepo", "oxlint", "nix-flake"];

for (const addon of universalAddons) {
it(`should work with ${addon} addon on any frontend`, async () => {
Expand Down Expand Up @@ -288,6 +288,7 @@ describe("Addon Configurations", () => {
"husky",
"turborepo",
"oxlint",
"nix-flake",
// Note: starlight, ultracite, ruler, fumadocs are prompt-controlled only
];

Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
description = "create-t-stack devshell flake";

inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-25.11";
};
};

outputs = { self, nixpkgs }:
let
mkShellFor = system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.mkShell {
packages = [
pkgs.bun
pkgs.nodejs_22
];

shellHook = ''
if [ -n "$PS1" ]; then
echo "bun: $(bun --version)"
fi
'';
};
in
{
# explicit nested outputs per system
devShells.x86_64-linux.default = mkShellFor "x86_64-linux";
devShells.aarch64-linux.default = mkShellFor "aarch64-linux";
devShells.x86_64-darwin.default = mkShellFor "x86_64-darwin";
devShells.aarch64-darwin.default = mkShellFor "aarch64-darwin";
};
}

1 change: 1 addition & 0 deletions packages/types/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const AddonsSchema = z
"oxlint",
"opentui",
"wxt",
"nix-flake",
"none",
])
.describe("Additional addons");
Expand Down