diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..fc832d8ca1 --- /dev/null +++ b/.envrc @@ -0,0 +1,8 @@ +# Ensure Nix is available even in non-login shells (what direnv uses) +if [ -r /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]; then + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh +elif [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then + . "$HOME/.nix-profile/etc/profile.d/nix.sh" +fi + +use flake diff --git a/.gitignore b/.gitignore index 982be8b22b..306ff894b2 100644 --- a/.gitignore +++ b/.gitignore @@ -82,4 +82,10 @@ test-output # Gemini local knowledge base files GEMINI.md -**/GEMINI.md \ No newline at end of file +**/GEMINI.md + +# Nix and direnv +.direnv/ +result* +!.envrc + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..5850e1a0c8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1759036355, + "narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..6d84efa777 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + description = "Development environment for the ping-javascript-sdk monorepo"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + # Get the pkgs set for the specific system + pkgs = import nixpkgs { inherit system; }; + + # Node.js version from your .node-version file + nodejs = pkgs.nodejs_22; + in + { + # The `devShell` is the development environment activated by `nix develop` + devShells.default = pkgs.mkShell { + # The packages available in the development shell. + packages = [ + nodejs + pkgs.pnpm + pkgs.git + ]; + + shellHook = '' + # This hook runs when you enter the shell + echo "---" + echo "Welcome to the Nix development environment for ping-javascript-sdk!" + echo "" + echo "Node.js version: $(node --version)" + echo "pnpm version: $(pnpm --version)" + echo "---" + ''; + }; + }); +}