mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-11 12:29:04 +00:00
The repository is licensed per component. SolidLSP (src/solidlsp,
test/solidlsp, test/resources) remains MIT-licensed and independently
reusable; the Serena application (src/serena, src/interprompt, scripts,
test/serena, docs) is licensed under GPL-3.0-or-later starting with the v2
licensing transition. The change is not retroactive: all releases and
commits up to v1.7.0 / 74c38a65 (tag mit-final) remain available under MIT.
Since MIT is GPL-compatible, a distribution combining both (such as the
serena-agent package) is as a whole subject to GPL-3.0-or-later, while the
SolidLSP files themselves stay MIT and can be extracted and used separately
under MIT terms. The distribution metadata therefore declares
GPL-3.0-or-later, with both license texts shipped alongside it.
Serena originally began under the GPL (v2) and was switched to MIT in
May 2025 following community requests. We consider that change a mistake;
the substantial changes in v2 make this the appropriate time to revert it.
We want the best version of Serena to remain free.
Changes:
* LICENSE is now the licensing overview; canonical license texts live in
LICENSES/ (MIT.txt is the previous LICENSE verbatim, GPL-3.0-or-later.txt
is the unmodified FSF text)
* pyproject.toml declares the PEP 639 license expression
"GPL-3.0-or-later" and bundles LICENSE and LICENSES/* as license files;
the deprecated MIT classifier is dropped and flake.nix declares gpl3Plus;
README has per-component license badges and a License section
* SPDX-License-Identifier headers in all Python sources under src/ and
scripts/, added by the new idempotent scripts/add_spdx_headers.py, which
gen_prompt_factory.py also uses to keep the header on the generated
module; existing third-party notices are preserved
* CLA.md: Contributor License Agreement (contributor retains copyright;
grants a perpetual, irrevocable license including relicensing under any
terms, incl. proprietary/commercial; patent grant; authority
representations), to be enforced repository-wide via cla-assistant.io
* CONTRIBUTING.md, PR template and a new docs page explain the licensing
boundary and the CLA workflow
215 lines
6.8 KiB
Nix
215 lines
6.8 KiB
Nix
{
|
|
description = "A powerful coding agent toolkit providing semantic retrieval and editing capabilities (MCP server & Agno integration)";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
flake-utils = {
|
|
url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
pyproject-nix = {
|
|
url = "github:pyproject-nix/pyproject.nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
uv2nix = {
|
|
url = "github:pyproject-nix/uv2nix";
|
|
inputs = {
|
|
pyproject-nix.follows = "pyproject-nix";
|
|
nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
pyproject-build-systems = {
|
|
url = "github:pyproject-nix/build-system-pkgs";
|
|
inputs = {
|
|
pyproject-nix.follows = "pyproject-nix";
|
|
uv2nix.follows = "uv2nix";
|
|
nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
};
|
|
|
|
outputs = {
|
|
nixpkgs,
|
|
uv2nix,
|
|
pyproject-nix,
|
|
pyproject-build-systems,
|
|
flake-utils,
|
|
...
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = import nixpkgs {inherit system;};
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
workspace = uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;};
|
|
|
|
overlay = workspace.mkPyprojectOverlay {
|
|
sourcePreference = "wheel"; # or sourcePreference = "sdist";
|
|
};
|
|
|
|
python = pkgs.python311;
|
|
pyprojectHacks = pkgs.callPackage pyproject-nix.build.hacks {};
|
|
|
|
pyprojectOverrides = final: prev:
|
|
{
|
|
# Add setuptools for packages that need it during build
|
|
ruamel-yaml-clib = prev.ruamel-yaml-clib.overrideAttrs (old: {
|
|
nativeBuildInputs =
|
|
(old.nativeBuildInputs or [])
|
|
++ [
|
|
final.setuptools
|
|
];
|
|
});
|
|
proxy-tools = prev.proxy-tools.overrideAttrs (old: {
|
|
nativeBuildInputs =
|
|
(old.nativeBuildInputs or [])
|
|
++ [
|
|
final.setuptools
|
|
];
|
|
});
|
|
pywebview = prev.pywebview.overrideAttrs (old: {
|
|
nativeBuildInputs =
|
|
(old.nativeBuildInputs or [])
|
|
++ [
|
|
final.setuptools
|
|
final.setuptools-scm
|
|
];
|
|
});
|
|
}
|
|
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
|
# pyproject-nix's virtualenv resolver follows pyproject-style
|
|
# passthru.dependencies, while these GI bindings are already packaged
|
|
# by nixpkgs' Python infrastructure. nixpkgsPrebuilt is the upstream
|
|
# adapter for that case:
|
|
# https://pyproject-nix.github.io/pyproject.nix/builders/hacks.html#using-prebuilt-packages-from-nixpkgs
|
|
pycairo = pyprojectHacks.nixpkgsPrebuilt {
|
|
from = python.pkgs.pycairo;
|
|
prev = {
|
|
passthru = {
|
|
dependencies = {};
|
|
optional-dependencies = {};
|
|
dependency-groups = {};
|
|
};
|
|
};
|
|
};
|
|
pygobject3 = pyprojectHacks.nixpkgsPrebuilt {
|
|
from = python.pkgs.pygobject3;
|
|
prev = {
|
|
passthru = {
|
|
dependencies = {
|
|
pycairo = [];
|
|
};
|
|
optional-dependencies = {};
|
|
dependency-groups = {};
|
|
};
|
|
};
|
|
};
|
|
|
|
# pystray has an optional AppIndicator backend on Linux. Its uv lock
|
|
# metadata does not encode the GI dependency, so add the runtime edge
|
|
# here while keeping pystray itself lockfile-driven.
|
|
pystray = prev.pystray.overrideAttrs (old: {
|
|
passthru =
|
|
(old.passthru or {})
|
|
// {
|
|
dependencies =
|
|
(old.passthru.dependencies or {})
|
|
// {
|
|
pygobject3 = [];
|
|
};
|
|
};
|
|
});
|
|
};
|
|
|
|
pythonSet =
|
|
(pkgs.callPackage pyproject-nix.build.packages {
|
|
inherit python;
|
|
}).overrideScope
|
|
(
|
|
lib.composeManyExtensions [
|
|
pyproject-build-systems.overlays.default
|
|
overlay
|
|
pyprojectOverrides
|
|
]
|
|
);
|
|
in rec {
|
|
formatter = pkgs.alejandra;
|
|
|
|
packages = {
|
|
serena-env = pythonSet.mkVirtualEnv "serena-env" workspace.deps.default;
|
|
serena = pkgs.stdenv.mkDerivation {
|
|
name = "serena";
|
|
dontUnpack = true;
|
|
dontWrapGApps = true;
|
|
nativeBuildInputs =
|
|
[pkgs.makeWrapper]
|
|
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
|
pkgs.wrapGAppsHook3
|
|
pkgs.gobject-introspection
|
|
];
|
|
buildInputs = lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
|
pkgs.gtk3
|
|
pkgs.libayatana-appindicator
|
|
];
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
${
|
|
lib.optionalString (!pkgs.stdenv.hostPlatform.isLinux) ''
|
|
ln -s ${packages.serena-env}/bin/serena $out/bin/serena
|
|
''
|
|
}
|
|
ln -s ${packages.serena-env}/bin/serena-hooks $out/bin/serena-hooks
|
|
|
|
runHook postInstall
|
|
'';
|
|
# Run the GApps fixup phase so the wrapper gets GI_TYPELIB_PATH for
|
|
# Gtk and AyatanaAppIndicator3. This is the same pattern nixpkgs uses
|
|
# for pystray consumers such as plex-mpv-shim and jellyfin-mpv-shim.
|
|
preFixup = lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
|
|
makeWrapper ${packages.serena-env}/bin/serena $out/bin/serena "''${gappsWrapperArgs[@]}"
|
|
'';
|
|
meta = {
|
|
description = "A powerful coding agent toolkit providing semantic retrieval and editing capabilities (MCP server & Agno integration)";
|
|
homepage = "https://oraios.github.io/serena";
|
|
changelog = "https://github.com/oraios/serena/blob/main/CHANGELOG.md";
|
|
mainProgram = "serena";
|
|
# The package as a whole is GPL-3.0-or-later; the bundled SolidLSP files remain MIT (see LICENSE)
|
|
license = pkgs.lib.licenses.gpl3Plus;
|
|
platforms = lib.platforms.all;
|
|
};
|
|
};
|
|
default = packages.serena;
|
|
};
|
|
|
|
apps.default = {
|
|
type = "app";
|
|
program = "${packages.default}/bin/serena";
|
|
};
|
|
|
|
devShells = {
|
|
default = pkgs.mkShell {
|
|
packages = [
|
|
python
|
|
pkgs.uv
|
|
];
|
|
env =
|
|
{
|
|
UV_PYTHON_DOWNLOADS = "never";
|
|
UV_PYTHON = python.interpreter;
|
|
}
|
|
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
|
LD_LIBRARY_PATH = lib.makeLibraryPath pkgs.pythonManylinuxPackages.manylinux1;
|
|
};
|
|
shellHook = ''
|
|
unset PYTHONPATH
|
|
'';
|
|
};
|
|
};
|
|
});
|
|
}
|