Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --release

- name: Clippy
run: cargo clippy --release -- -D warnings

fmt:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Format
run: cargo fmt -- --check
22 changes: 0 additions & 22 deletions .github/workflows/rust.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@
node_modules/
package-lock.json
yarn.lock

# Nix development
result
result-*
.dirlocals
.envrc
20 changes: 20 additions & 0 deletions .nix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Nix Configuration Files

This directory contains supplementary Nix configurations for advanced use cases.

## Files

- `shell.nix` - (Optional) Legacy shell.nix for compatibility
- `default.nix` - (Optional) Legacy default.nix for compatibility

## Using flake.nix (Recommended)

Use the modern flake.nix at the root instead:

```bash
nix develop # Enter dev shell
nix build # Build package
nix build .#docker # Build Docker image
```

See [docs/NIX.md](../docs/NIX.md) for full documentation.
5 changes: 5 additions & 0 deletions .nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Legacy Nix support (for non-flake setups)
# This file allows `nix-build` to work without flakes
# Usage: nix-build .nix/

(import <nixpkgs> {}).callPackage ./package.nix { }
24 changes: 24 additions & 0 deletions .nix/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Legacy shell.nix for non-flake Nix users
# Usage: nix-shell .nix/shell.nix

let
nixpkgs = import <nixpkgs> { };
in

nixpkgs.mkShell {
buildInputs = with nixpkgs; [
rustup
pkg-config
openssl
cargo-watch
cargo-edit
cargo-outdated
];

shellHook = ''
echo "🧙 Langsmith dev environment (legacy nix-shell)"
echo "Run: cargo build, cargo test, cargo run -- --help"
echo ""
echo "⚠️ Note: Flakes are recommended. Use 'nix develop' instead."
'';
}
170 changes: 170 additions & 0 deletions flake.lock

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

90 changes: 90 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
description = "Langsmith - Automatic i18n extraction and translation CLI";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};

outputs = { self, nixpkgs, flake-utils, rust-overlay, pre-commit-hooks }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};

rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" ];
};

version = "0.1.0";

in
{
# Development shell with all tools
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
rustToolchain
cargo-watch
cargo-edit
cargo-outdated
cargo-deny
cargo-audit
pkg-config
openssl
pre-commit
git
];

shellHook = ''
echo "🧙 Langsmith dev environment loaded (Nix)"
echo "Run: cargo build, cargo test, cargo run -- --help"
'';
};

# Production build (for current system)
packages.default = pkgs.rustPlatform.buildRustPackage {
name = "langsmith";
inherit version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;

buildInputs = with pkgs; [
pkg-config
openssl
];

meta = with pkgs.lib; {
description = "Automatic i18n extraction and translation CLI";
homepage = "https://github.com/chahinebenlahcen/langsmith";
license = licenses.mit;
maintainers = [];
mainProgram = "langsmith";
};
};

# Docker image
packages.docker = pkgs.dockerTools.buildLayeredImage {
name = "langsmith";
tag = version;
contents = [ self.packages.${system}.default pkgs.cacert ];
config = {
Cmd = [ "${self.packages.${system}.default}/bin/langsmith" ];
Env = [ "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ];
};
};

# CLI app
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/langsmith";
};

# Quality checks (disabled in flake check, available in nix develop)
checks = { };
}
);
}
Loading