Skip to content
Open
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
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Auto-activate the nix dev shell via direnv
# Install direnv + nix-direnv for seamless shell activation
use flake
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ npm-debug.log
*.DS_store
./site/_site
.jekyll-cache
pnpm-lock.yaml
pnpm-lock.yaml

# Nix / direnv
result
.direnv/
61 changes: 61 additions & 0 deletions flake.lock

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

58 changes: 58 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
description = "Apache Flagon — behavioral analytics monorepo";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# Node / TypeScript (UserALE.js)
nodejs_24
pnpm
typescript

# Python (Distill)
python313
uv

# Pre-commit hooks
lefthook

# Protobuf (schema codegen — future use)
buf

# Tools
git
jq
curl
nixpkgs-fmt
];

shellHook = ''
echo "🔥 Apache Flagon dev shell"
echo " node: $(node --version)"
echo " pnpm: $(pnpm --version)"
echo " tsc: $(tsc --version)"
echo " python: $(python3 --version)"
echo " buf: $(buf --version 2>&1 | head -1)"
echo ""

# Install lefthook git hooks on first entry
if [ ! -f .git/hooks/pre-commit ] || ! grep -q lefthook .git/hooks/pre-commit 2>/dev/null; then
echo "Installing lefthook git hooks..."
lefthook install
fi

echo "Run 'pnpm install' in products/userale to get started"
'';
};
});
}
41 changes: 41 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

pre-commit:
parallel: true
commands:
nix-fmt:
glob: "*.nix"
run: nixpkgs-fmt {staged_files}
ts-lint:
glob: "*.{ts,tsx}"
root: "products/userale/"
run: pnpm eslint {staged_files}
ts-fmt:
glob: "*.{ts,tsx,js,jsx,json,css,md}"
root: "products/userale/"
run: pnpm prettier --check {staged_files}

pre-push:
parallel: false
commands:
userale-build:
root: "products/userale/packages/flagon-userale/"
run: npx tsup --onSuccess 'tsc --emitDeclarationOnly --declaration'
userale-test:
root: "products/userale/packages/flagon-userale/"
run: npx jest -c ./test/jest.config.ts
Loading