Skip to content

Commit

Permalink
improve: flake.nix (add packages)
Browse files Browse the repository at this point in the history
  • Loading branch information
luochen1990 committed Sep 20, 2024
1 parent 44b2758 commit 828b6c2
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 8 deletions.
48 changes: 41 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

inputs = {
nixpkgs.url = "nixpkgs";
easy-sync.url = "github:luochen1990/easy-sync/master";
};

outputs = { self, nixpkgs }:
outputs = { self, nixpkgs, easy-sync }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
eachSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
Expand All @@ -15,6 +16,35 @@
});
in
{

packages = eachSystem ({pkgs, system, ...}: rec {
default = ai-powered;
ai-powered = let
pyproject = pkgs.lib.importTOML ./pyproject.toml;
meta = pyproject.tool.poetry;
pypkgs = pkgs.python3Packages;
in
pypkgs.buildPythonPackage {
pname = meta.name;
version = meta.version;
pyproject = true;
src = ./.;
buildInputs = [ pypkgs.poetry-core ];
dependencies = [
easy-sync.packages.${system}.easy-sync
pypkgs.msgspec
pypkgs.openai
];
doCheck = true;
meta = with pkgs.lib; {
description = meta.description;
homepage = meta.repository;
license = licenses.asl20;
maintainers = with maintainers; [ luochen1990 ];
};
};
});

devShells = eachSystem ({pkgs, python, ...}: rec {
default = poetry;

Expand Down

0 comments on commit 828b6c2

Please sign in to comment.