diff --git a/flake.lock b/flake.lock index 9227160..f932ff5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,20 +1,20 @@ { "nodes": { - "flake-utils": { + "flake-parts": { "inputs": { - "systems": "systems" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "lastModified": 1765835352, + "narHash": "sha256-XswHlK/Qtjasvhd1nOa1e8MgZ8GS//jBoTqWtrS1Giw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "a34fae9c08a15ad73f295041fec82323541400a9", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, @@ -34,26 +34,26 @@ "type": "github" } }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { + "nixpkgs-lib": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1765674936, + "narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "nix-community", + "repo": "nixpkgs.lib", "type": "github" } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 3333f05..56ade39 100644 --- a/flake.nix +++ b/flake.nix @@ -3,30 +3,37 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - pnpm_10 - ]; + outputs = + inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "aarch64-darwin" + ]; - shellHook = '' - echo "StackOne AI Node SDK development environment" + perSystem = + { pkgs, ... }: + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + pnpm_10 + nixfmt-rfc-style + ]; - # Install dependencies only if node_modules/.pnpm/lock.yaml is older than pnpm-lock.yaml - if [ ! -f node_modules/.pnpm/lock.yaml ] || [ pnpm-lock.yaml -nt node_modules/.pnpm/lock.yaml ]; then - echo "📦 Installing dependencies..." - pnpm install --frozen-lockfile - fi - ''; + shellHook = '' + echo "StackOne AI Node SDK development environment" + + # Install dependencies only if node_modules/.pnpm/lock.yaml is older than pnpm-lock.yaml + if [ ! -f node_modules/.pnpm/lock.yaml ] || [ pnpm-lock.yaml -nt node_modules/.pnpm/lock.yaml ]; then + echo "📦 Installing dependencies..." + pnpm install --frozen-lockfile + fi + ''; + }; }; - } - ); + }; } diff --git a/lefthook.yaml b/lefthook.yaml index d982f1f..30a7558 100644 --- a/lefthook.yaml +++ b/lefthook.yaml @@ -9,6 +9,10 @@ pre-commit: glob: '*' run: pnpm oxfmt --no-error-on-unmatched-pattern {staged_files} stage_fixed: true + - name: nixfmt + glob: '*.nix' + run: nix develop --command nixfmt {staged_files} + stage_fixed: true pre-push: jobs: