diff --git a/flake.lock b/flake.lock index 5af8293..4df1639 100644 --- a/flake.lock +++ b/flake.lock @@ -39,16 +39,16 @@ ] }, "locked": { - "lastModified": 1771551920, - "narHash": "sha256-MPr+bJ3GVuVf5P/wCHxg+fk3+4Aca4EaV5NVtshAhuk=", + "lastModified": 1772031356, + "narHash": "sha256-PA3/P5nUDlrKD6xjDXFoNNF8U2Wzz2JeeY4H+CzWWgY=", "owner": "anomalyco", "repo": "opencode", - "rev": "1eb6caa3c6703ca7269ef141ff559fd5d3167752", + "rev": "de2bc25677b419d2af0da8b6a24a05d3f22b67a8", "type": "github" }, "original": { "owner": "anomalyco", - "ref": "v1.2.9", + "ref": "v1.2.14", "repo": "opencode", "type": "github" } diff --git a/flake.nix b/flake.nix index b01822a..b068095 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ # opencode needs newer bun from master opencode = { - url = "github:anomalyco/opencode/v1.2.9"; + url = "github:anomalyco/opencode/v1.2.14"; inputs.nixpkgs.follows = "nixpkgs-master"; }; diff --git a/pkgs/n8n/default.nix b/pkgs/n8n/default.nix index 8931b37..3eb8242 100644 --- a/pkgs/n8n/default.nix +++ b/pkgs/n8n/default.nix @@ -1,111 +1,127 @@ -{ stdenv, lib, nixosTests, fetchFromGitHub, nodejs, pnpm_10, fetchPnpmDeps -, pnpmConfigHook, python3, node-gyp, cctools, xcbuild, libkrb5, libmongocrypt -, libpq, makeWrapper, }: -let python = python3.withPackages (ps: with ps; [ websockets ]); -in stdenv.mkDerivation (finalAttrs: { - pname = "n8n"; - version = "2.8.3"; +{ + stdenv, + lib, + nixosTests, + fetchFromGitHub, + nodejs, + pnpm_10, + fetchPnpmDeps, + pnpmConfigHook, + python3, + node-gyp, + cctools, + xcbuild, + libkrb5, + libmongocrypt, + libpq, + makeWrapper, +}: let + python = python3.withPackages (ps: with ps; [websockets]); +in + stdenv.mkDerivation (finalAttrs: { + pname = "n8n"; + version = "2.9.4"; - src = fetchFromGitHub { - owner = "n8n-io"; - repo = "n8n"; - tag = "n8n@${finalAttrs.version}"; - hash = "sha256-xbJZD+L/8ZK7GPqFKO6H/Cg40Pk2cqN3MWC+mNFVxbI="; - }; + src = fetchFromGitHub { + owner = "n8n-io"; + repo = "n8n"; + tag = "n8n@${finalAttrs.version}"; + hash = "sha256-XXQPZHtY66gOQ+nYH+Q1IjbR+SRZ9g06sgBy2x8gGh4="; + }; - pnpmDeps = fetchPnpmDeps { - inherit (finalAttrs) pname version src; - pnpm = pnpm_10; - fetcherVersion = 3; - hash = "sha256-gX4pYiztKIRFbJNZhtQviWpp80teOzX1JaYKylGe4TY="; - }; + pnpmDeps = fetchPnpmDeps { + inherit (finalAttrs) pname version src; + pnpm = pnpm_10; + fetcherVersion = 3; + hash = "sha256-TU7HIShYj20QtdcthP0nQdubYl0bdy+XM3CoX5Rvhzk="; + }; - nativeBuildInputs = [ - pnpmConfigHook - pnpm_10 - python3 # required to build sqlite3 bindings - node-gyp # required to build sqlite3 bindings - makeWrapper - ] ++ lib.optional stdenv.hostPlatform.isDarwin [ cctools xcbuild ]; + nativeBuildInputs = + [ + pnpmConfigHook + pnpm_10 + python3 # required to build sqlite3 bindings + node-gyp # required to build sqlite3 bindings + makeWrapper + ] + ++ lib.optional stdenv.hostPlatform.isDarwin [cctools xcbuild]; - buildInputs = [ nodejs libkrb5 libmongocrypt libpq ]; + buildInputs = [nodejs libkrb5 libmongocrypt libpq]; - buildPhase = '' - runHook preBuild + buildPhase = '' + runHook preBuild - pushd node_modules/sqlite3 - node-gyp rebuild - popd + pushd node_modules/sqlite3 + node-gyp rebuild + popd - # TODO: use deploy after resolved https://github.com/pnpm/pnpm/issues/5315 - pnpm build --filter=n8n + # TODO: use deploy after resolved https://github.com/pnpm/pnpm/issues/5315 + pnpm build --filter=n8n - runHook postBuild - ''; - - preInstall = '' - echo "Removing non-deterministic and unnecessary files" - - find -type d -name .turbo -exec rm -rf {} + - rm node_modules/.modules.yaml - rm packages/nodes-base/dist/types/nodes.json - - CI=true pnpm --ignore-scripts prune --prod - find -type f \( -name "*.ts" -o -name "*.map" \) -exec rm -rf {} + - rm -rf node_modules/.pnpm/{typescript*,prettier*} - shopt -s globstar - # https://github.com/pnpm/pnpm/issues/3645 - find node_modules packages/**/node_modules -xtype l -delete - - echo "Removed non-deterministic and unnecessary files" - ''; - - installPhase = '' - runHook preInstall - - mkdir -p $out/{bin,lib/n8n} - cp -r {packages,node_modules} $out/lib/n8n - - makeWrapper $out/lib/n8n/packages/cli/bin/n8n $out/bin/n8n \ - --set N8N_RELEASE_TYPE "stable" - - # JavaScript runner - makeWrapper ${nodejs}/bin/node $out/bin/n8n-task-runner \ - --add-flags "$out/lib/n8n/packages/@n8n/task-runner/dist/start.js" - - # Python runner - mkdir -p $out/lib/n8n-task-runner-python - cp -r packages/@n8n/task-runner-python/* $out/lib/n8n-task-runner-python/ - makeWrapper ${python}/bin/python $out/bin/n8n-task-runner-python \ - --add-flags "$out/lib/n8n-task-runner-python/src/main.py" \ - --prefix PYTHONPATH : "$out/lib/n8n-task-runner-python" - - runHook postInstall - ''; - - passthru = { - tests = nixosTests.n8n; - updateScript = ./update.sh; - }; - - # this package has ~80000 files, these take too long and seem to be unnecessary - dontStrip = true; - dontPatchELF = true; - dontRewriteSymlinks = true; - - meta = { - description = - "Free and source-available fair-code licensed workflow automation tool"; - longDescription = '' - Free and source-available fair-code licensed workflow automation tool. - Easily automate tasks across different services. + runHook postBuild ''; - homepage = "https://n8n.io"; - changelog = - "https://github.com/n8n-io/n8n/releases/tag/n8n@${finalAttrs.version}"; - maintainers = with lib.maintainers; [ gepbird AdrienLemaire sweenu ]; - license = lib.licenses.sustainableUse; - mainProgram = "n8n"; - platforms = lib.platforms.unix; - }; -}) + + preInstall = '' + echo "Removing non-deterministic and unnecessary files" + + find -type d -name .turbo -exec rm -rf {} + + rm node_modules/.modules.yaml + rm packages/nodes-base/dist/types/nodes.json + + CI=true pnpm --ignore-scripts prune --prod + find -type f \( -name "*.ts" -o -name "*.map" \) -exec rm -rf {} + + rm -rf node_modules/.pnpm/{typescript*,prettier*} + shopt -s globstar + # https://github.com/pnpm/pnpm/issues/3645 + find node_modules packages/**/node_modules -xtype l -delete + + echo "Removed non-deterministic and unnecessary files" + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/{bin,lib/n8n} + cp -r {packages,node_modules} $out/lib/n8n + + makeWrapper $out/lib/n8n/packages/cli/bin/n8n $out/bin/n8n \ + --set N8N_RELEASE_TYPE "stable" + + # JavaScript runner + makeWrapper ${nodejs}/bin/node $out/bin/n8n-task-runner \ + --add-flags "$out/lib/n8n/packages/@n8n/task-runner/dist/start.js" + + # Python runner + mkdir -p $out/lib/n8n-task-runner-python + cp -r packages/@n8n/task-runner-python/* $out/lib/n8n-task-runner-python/ + makeWrapper ${python}/bin/python $out/bin/n8n-task-runner-python \ + --add-flags "$out/lib/n8n-task-runner-python/src/main.py" \ + --prefix PYTHONPATH : "$out/lib/n8n-task-runner-python" + + runHook postInstall + ''; + + passthru = { + tests = nixosTests.n8n; + updateScript = ./update.sh; + }; + + # this package has ~80000 files, these take too long and seem to be unnecessary + dontStrip = true; + dontPatchELF = true; + dontRewriteSymlinks = true; + + meta = { + description = "Free and source-available fair-code licensed workflow automation tool"; + longDescription = '' + Free and source-available fair-code licensed workflow automation tool. + Easily automate tasks across different services. + ''; + homepage = "https://n8n.io"; + changelog = "https://github.com/n8n-io/n8n/releases/tag/n8n@${finalAttrs.version}"; + maintainers = with lib.maintainers; [gepbird AdrienLemaire sweenu]; + license = lib.licenses.sustainableUse; + mainProgram = "n8n"; + platforms = lib.platforms.unix; + }; + })