Files
OpenSpec/flake.nix
T
Clay GoodandClaude Opus 5 086c93b40b chore(deps-dev): bump changesets, eslint and typescript-eslint (#1901)
Applies dependabot #1898 (lockfile-only: @changesets/changelog-github 1.0.1,
@changesets/cli 3.0.2, eslint 10.10.0, typescript-eslint 8.70.0) plus the two
follow-ups its CI needed: the transitive esbuild 0.28.1 -> 0.28.2 bump in
allowBuilds, and the pnpmDeps hash in flake.nix computed by the Nix job.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 19:11:26 +00:00

132 lines
3.7 KiB
Nix

{
description = "OpenSpec - AI-native system for spec-driven development";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
in
{
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
in
{
default = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "openspec";
version = (builtins.fromJSON (builtins.readFile ./package.json)).version;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./src
./bin
./schemas
./scripts
./test
./package.json
./pnpm-lock.yaml
./pnpm-workspace.yaml
./tsconfig.json
./build.js
./vitest.config.ts
./vitest.setup.ts
./eslint.config.js
];
};
pnpmDeps = pkgs.fetchPnpmDeps {
inherit (finalAttrs) pname version src;
pnpm = pkgs.pnpm_10;
fetcherVersion = 3;
hash = "sha256-oz4tsfu05IPDMaBBp5jLbfsxvTmw1oVtNFtpvudCOPE=";
};
nativeBuildInputs = with pkgs; [
installShellFiles
nodejs_22
npmHooks.npmInstallHook
pnpmConfigHook
pnpm_10
];
buildPhase = ''
runHook preBuild
pnpm run build
runHook postBuild
'';
dontNpmPrune = true;
# `openspec completion generate` renders a static command registry, so it
# needs no project and no network. Opting out of telemetry also disables
# the update check, keeping the build offline.
postInstall = lib.optionalString (pkgs.stdenv.buildPlatform.canExecute pkgs.stdenv.hostPlatform) ''
export OPENSPEC_TELEMETRY=0
completions=$(mktemp -d)
for shell in bash fish zsh; do
$out/bin/openspec completion generate "$shell" > "$completions/openspec.$shell"
done
installShellCompletion --cmd openspec \
--bash "$completions/openspec.bash" \
--fish "$completions/openspec.fish" \
--zsh "$completions/openspec.zsh"
'';
meta = with pkgs.lib; {
description = "AI-native system for spec-driven development";
homepage = "https://github.com/Fission-AI/OpenSpec";
license = licenses.mit;
maintainers = [ ];
mainProgram = "openspec";
};
});
}
);
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/openspec";
};
});
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_22
pnpm_10
];
shellHook = ''
echo "OpenSpec development environment"
echo "Node version: $(node --version)"
echo "pnpm version: $(pnpm --version)"
echo "Run 'pnpm install' to install dependencies"
'';
};
}
);
};
}