mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
109 lines
2.3 KiB
Nix
109 lines
2.3 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
nixosTests,
|
|
fetchFromGitHub,
|
|
nodejs,
|
|
pnpm,
|
|
python3,
|
|
node-gyp,
|
|
cacert,
|
|
xcbuild,
|
|
libkrb5,
|
|
libmongocrypt,
|
|
postgresql,
|
|
makeWrapper,
|
|
nix-update-script,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "n8n";
|
|
version = "1.60.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "n8n-io";
|
|
repo = "n8n";
|
|
rev = "n8n@${finalAttrs.version}";
|
|
hash = "sha256-G//+9Mucm/yH8XlA8/OO09lg9mKlo1S+Pyfmsp5MQhk=";
|
|
};
|
|
|
|
pnpmDeps = pnpm.fetchDeps {
|
|
inherit (finalAttrs) pname version src;
|
|
hash = "sha256-61xRNwJUFQrj7aw/+SqMABb8W+sJsVZ6aTgU9N7ssDo=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
pnpm.configHook
|
|
python3 # required to build sqlite3 bindings
|
|
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
|
|
|
|
# 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
|
|
|
|
mkdir -p $out/{bin,lib/n8n}
|
|
mv {packages,node_modules} $out/lib/n8n
|
|
|
|
makeWrapper $out/lib/n8n/packages/cli/bin/n8n $out/bin/n8n \
|
|
--set N8N_RELEASE_TYPE "stable"
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru = {
|
|
tests = nixosTests.n8n;
|
|
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
|
|
gepbird
|
|
];
|
|
license = licenses.sustainableUse;
|
|
mainProgram = "n8n";
|
|
platforms = platforms.unix;
|
|
};
|
|
})
|