Skip to content

Instantly share code, notes, and snippets.

@LennyPenny
Created December 9, 2023 15:50
Show Gist options
  • Save LennyPenny/3c216cd0187a9f644deff267a5fe7f96 to your computer and use it in GitHub Desktop.
Save LennyPenny/3c216cd0187a9f644deff267a5fe7f96 to your computer and use it in GitHub Desktop.
{
description = "A Nix flake for the Continue server";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
continueServer.url = "github:continuedev/continue"; # Fetching the server directory
continueServer.flake = false;
};
outputs = { self, nixpkgs, flake-utils, poetry2nix, continueServer }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication defaultPoetryOverrides;
pypkgs-build-requirements = {
directory-tree = [ "setuptools" ];
ripgrepy = [ "setuptools" ];
pypika = [ "setuptools" ];
bs4 = [ "setuptools" ];
chroma-hnswlib = [ "setuptools" "pybind11" ];
replicate = [ "setuptools" ];
meilisearch-python-async = [ "poetry" ];
};
p2n-overrides = defaultPoetryOverrides.extend
(self: super:
{
tiktoken = pkgs.python311Packages.tiktoken;
tokenizers = pkgs.python311Packages.tokenizers;
multidict = pkgs.python311Packages.multidict;
grpcio = pkgs.python311Packages.grpcio;
opentelemetry-exporter-otlp-proto-grpc = pkgs.python311Packages.opentelemetry-exporter-otlp-proto-grpc;
pynacl = pkgs.python311Packages.pynacl;
pygithub = pkgs.python311Packages.pygithub;
pydantic = pkgs.python311Packages.pydantic;
typing-extensions = pkgs.python311Packages.typing-extensions;
opentelemetry-semantic-conventions = pkgs.python311Packages.opentelemetry-semantic-conventions;
opentelemetry-sdk = pkgs.python311Packages.opentelemetry-sdk;
zipp = pkgs.python311Packages.zipp;
toml = pkgs.python311Packages.toml;
backoff = pkgs.python311Packages.backoff;
importlib-metadata = pkgs.python311Packages.importlib-metadata;
wrapt = pkgs.python311Packages.wrapt;
protobuf = pkgs.python311Packages.protobuf;
opentelemetry-api = pkgs.python311Packages.opentelemetry-api;
numpy = pkgs.python311Packages.numpy;
six = pkgs.python311Packages.six;
filelock = pkgs.python311Packages.filelock;
pyjwt = pkgs.python311Packages.pyjwt;
cryptography = pkgs.python311Packages.cryptography;
requests = pkgs.python311Packages.requests;
charset-normalizer = pkgs.python311Packages.charset-normalizer;
urllib3 = pkgs.python311Packages.urllib3;
pygments = pkgs.python311Packages.pygments;
asttokens = pkgs.python311Packages.asttokens;
python-dateutil = pkgs.python311Packages.python-dateutil;
certifi = pkgs.python311Packages.certifi;
idna = pkgs.python311Packages.idna;
executing = pkgs.python311Packages.executing;
} //
builtins.mapAttrs
(package: build-requirements:
(builtins.getAttr package super).overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ (builtins.map (pkg: if builtins.isString pkg then builtins.getAttr pkg super else pkg) build-requirements);
})
)
pypkgs-build-requirements
);
in
{
packages = {
continuedev = mkPoetryApplication {
projectDir = "${continueServer}/server";
pyproject = ./pyproject.toml;
poetrylock = "${continueServer}/server/poetry.lock";
overrides = p2n-overrides;
};
default = self.packages.${system}.continuedev;
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.continuedev ];
packages = [ pkgs.poetry ];
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment