nixpkgs/pkgs/by-name/n8/n8n/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

109 lines
2.3 KiB
Nix
Raw Normal View History

{
stdenv,
lib,
nixosTests,
fetchFromGitHub,
nodejs,
pnpm,
python3,
2024-08-13 12:34:26 +00:00
node-gyp,
cacert,
xcbuild,
libkrb5,
libmongocrypt,
postgresql,
makeWrapper,
2024-08-24 20:06:40 +00:00
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "n8n";
2024-09-30 20:44:37 +00:00
version = "1.61.0";
src = fetchFromGitHub {
owner = "n8n-io";
repo = "n8n";
rev = "n8n@${finalAttrs.version}";
2024-09-30 20:44:37 +00:00
hash = "sha256-9hIwpid/uly7wUcrBgLkSw+Aah8OQ66MgrMQbs/5v1Y=";
};
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
2024-10-18 22:31:36 +00:00
hash = "sha256-lZLWqlR6xq7DYpnydgJK8gL7WdfZcRU+8Autzh6e7kY=";
};
nativeBuildInputs = [
pnpm.configHook
python3 # required to build sqlite3 bindings
2024-08-13 12:34:26 +00:00
node-gyp # required to build sqlite3 bindings
cacert # required for rustls-native-certs (dependency of turbo build tool)
makeWrapper
] ++ lib.optional stdenv.hostPlatform.isDarwin [ xcbuild ];
buildInputs = [
nodejs
libkrb5
libmongocrypt
postgresql
];
buildPhase = ''
runHook preBuild
pushd node_modules/sqlite3
node-gyp rebuild
popd
2024-07-02 12:02:26 +00:00
# TODO: use deploy after resolved https://github.com/pnpm/pnpm/issues/5315
pnpm build --filter=n8n
runHook postBuild
'';
preInstall = ''
echo "Removing non-deterministic files"
rm -r $(find -type d -name .turbo)
rm node_modules/.modules.yaml
rm packages/nodes-base/dist/types/nodes.json
echo "Removed non-deterministic files"
'';
installPhase = ''
runHook preInstall
2024-07-02 12:02:26 +00:00
mkdir -p $out/{bin,lib/n8n}
mv {packages,node_modules} $out/lib/n8n
2024-07-02 12:02:26 +00:00
makeWrapper $out/lib/n8n/packages/cli/bin/n8n $out/bin/n8n \
--set N8N_RELEASE_TYPE "stable"
runHook postInstall
'';
passthru = {
tests = nixosTests.n8n;
2024-08-24 20:06:40 +00:00
updateScript = nix-update-script { };
};
dontStrip = true;
meta = with lib; {
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/${finalAttrs.src.rev}";
maintainers = with maintainers; [
freezeboy
2024-06-14 12:16:50 +00:00
gepbird
];
license = licenses.sustainableUse;
mainProgram = "n8n";
2024-07-02 12:02:26 +00:00
platforms = platforms.unix;
};
})