flake: fix/update

This commit is contained in:
jaredmontoya
2025-02-26 15:21:02 +01:00
parent f9395fa108
commit 1f765c5b53
31 changed files with 72 additions and 45 deletions

2
.envrc
View File

@@ -1,2 +1,2 @@
watch_file shell.nix
watch_file nix/shell.nix
use flake

View File

@@ -22,6 +22,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Set up Go
uses: actions/setup-go@v4
with:
@@ -29,3 +32,6 @@ jobs:
- name: Run tests
run: go test -v ./...
- name: Check Formatting
run: nix flake check

View File

@@ -25,9 +25,6 @@ jobs:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Setup Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Set up Git
run: |
git config user.name "github-actions[bot]"
@@ -63,21 +60,21 @@ jobs:
- name: Update version.nix file
run: |
echo "\"${{ env.new_version }}\"" > pkgs/fabric/version.nix
echo "\"${{ env.new_version }}\"" > nix/pkgs/fabric/version.nix
- name: Format source codes
- name: Format source code
run: |
go fmt ./...
nix fmt
- name: Update gomod2nix.toml file
run: |
nix run .#gomod2nix
nix run .#gomod2nix -- --outdir nix/pkgs/fabric
- name: Commit changes
run: |
git add version.go
git add pkgs/fabric/version.nix
git add gomod2nix.toml
git add nix/pkgs/fabric/version.nix
git add nix/pkgs/fabric/gomod2nix.toml
git add .
if ! git diff --staged --quiet; then
git commit -m "Update version to ${{ env.new_tag }} and commit $commit_hash"

View File

@@ -1,10 +1,11 @@
package cli
import (
"github.com/danielmiessler/fabric/core"
"os"
"testing"
"github.com/danielmiessler/fabric/core"
"github.com/stretchr/testify/assert"
)

View File

@@ -2,8 +2,9 @@ package cli
import (
"fmt"
"github.com/atotto/clipboard"
"os"
"github.com/atotto/clipboard"
)
func CopyToClipboard(message string) (err error) {

View File

@@ -6,11 +6,12 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/gabriel-vasile/mimetype"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"github.com/gabriel-vasile/mimetype"
)
type Attachment struct {

View File

@@ -1,9 +1,10 @@
package common
import (
"testing"
goopenai "github.com/sashabaranov/go-openai"
"github.com/stretchr/testify/assert"
"testing"
)
func TestNormalizeMessages(t *testing.T) {

View File

@@ -2,6 +2,7 @@ package common
import (
"fmt"
"github.com/samber/lo"
)

View File

@@ -3,11 +3,12 @@ package core
import (
"bytes"
"fmt"
"github.com/danielmiessler/fabric/plugins/ai/exolab"
"os"
"path/filepath"
"strconv"
"github.com/danielmiessler/fabric/plugins/ai/exolab"
"github.com/samber/lo"
"github.com/danielmiessler/fabric/common"

18
flake.lock generated
View File

@@ -26,11 +26,11 @@
]
},
"locked": {
"lastModified": 1729448365,
"narHash": "sha256-oquZeWTYWTr5IxfwEzgsxjtD8SSFZYLdO9DaQb70vNU=",
"lastModified": 1733668782,
"narHash": "sha256-tPsqU00FhgdFr0JiQUiBMgPVbl1jbPCY5gbFiJycL3I=",
"owner": "nix-community",
"repo": "gomod2nix",
"rev": "5d387097aa716f35dd99d848dc26d8d5b62a104c",
"rev": "514283ec89c39ad0079ff2f3b1437404e4cba608",
"type": "github"
},
"original": {
@@ -41,11 +41,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1729665710,
"narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=",
"lastModified": 1736344531,
"narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d",
"rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912",
"type": "github"
},
"original": {
@@ -100,11 +100,11 @@
]
},
"locked": {
"lastModified": 1729613947,
"narHash": "sha256-XGOvuIPW1XRfPgHtGYXd5MAmJzZtOuwlfKDgxX5KT3s=",
"lastModified": 1736154270,
"narHash": "sha256-p2r8xhQZ3TYIEKBoiEhllKWQqWNJNoT9v64Vmg4q8Zw=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "aac86347fb5063960eccb19493e0cadcdb4205ca",
"rev": "13c913f5deb3a5c08bb810efd89dc8cb24dd968b",
"type": "github"
},
"original": {

View File

@@ -33,7 +33,7 @@
let
pkgs = nixpkgs.legacyPackages.${system};
in
treefmt-nix.lib.evalModule pkgs ./treefmt.nix
treefmt-nix.lib.evalModule pkgs ./nix/treefmt.nix
);
in
{
@@ -49,7 +49,7 @@
pkgs = nixpkgs.legacyPackages.${system};
goEnv = gomod2nix.legacyPackages.${system}.mkGoEnv { pwd = ./.; };
in
import ./shell.nix {
import ./nix/shell.nix {
inherit pkgs goEnv;
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
}
@@ -62,7 +62,7 @@
in
{
default = self.packages.${system}.fabric;
fabric = pkgs.callPackage ./pkgs/fabric {
fabric = pkgs.callPackage ./nix/pkgs/fabric {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;

View File

@@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/jessevdk/go-flags"
"os"
"github.com/jessevdk/go-flags"
"github.com/danielmiessler/fabric/cli"
)

View File

@@ -6,9 +6,11 @@
buildGoApplication {
pname = "fabric-ai";
version = import ./version.nix;
src = ../../.;
pwd = ../../.;
modules = ../../gomod2nix.toml;
src = ../../../.;
pwd = ../../../.;
modules = ./gomod2nix.toml;
doCheck = false;
ldflags = [
"-s"

View File

@@ -6,6 +6,7 @@
statix.enable = true;
nixfmt.enable = true;
goimports.enable = true;
gofmt.enable = true;
};
}

View File

@@ -1,10 +1,11 @@
package azure
import (
"strings"
"github.com/danielmiessler/fabric/plugins"
"github.com/danielmiessler/fabric/plugins/ai/openai"
goopenai "github.com/sashabaranov/go-openai"
"strings"
)
func NewClient() (ret *Client) {

View File

@@ -1,10 +1,11 @@
package dryrun
import (
"github.com/danielmiessler/fabric/common"
"github.com/sashabaranov/go-openai"
"reflect"
"testing"
"github.com/danielmiessler/fabric/common"
"github.com/sashabaranov/go-openai"
)
// Test generated using Keploy

View File

@@ -1,9 +1,10 @@
package exolab
import (
"strings"
"github.com/danielmiessler/fabric/plugins"
"github.com/danielmiessler/fabric/plugins/ai/openai"
"strings"
goopenai "github.com/sashabaranov/go-openai"
)

View File

@@ -4,9 +4,10 @@ import (
"context"
"errors"
"fmt"
"strings"
"github.com/danielmiessler/fabric/plugins"
goopenai "github.com/sashabaranov/go-openai"
"strings"
"github.com/danielmiessler/fabric/common"
"github.com/google/generative-ai-go/genai"

View File

@@ -1,8 +1,9 @@
package gemini
import (
"github.com/google/generative-ai-go/genai"
"testing"
"github.com/google/generative-ai-go/genai"
)
// Test generated using Keploy

View File

@@ -4,10 +4,11 @@ import (
"context"
"errors"
"fmt"
"github.com/danielmiessler/fabric/plugins"
"io"
"log/slog"
"github.com/danielmiessler/fabric/plugins"
"github.com/danielmiessler/fabric/common"
"github.com/samber/lo"
"github.com/sashabaranov/go-openai"

View File

@@ -2,6 +2,7 @@ package ai
import (
"context"
"github.com/danielmiessler/fabric/plugins"
goopenai "github.com/sashabaranov/go-openai"

View File

@@ -4,8 +4,9 @@ import (
"bytes"
"context"
"fmt"
"github.com/danielmiessler/fabric/plugins"
"sync"
"github.com/danielmiessler/fabric/plugins"
)
func NewVendorsManager() *VendorsManager {

View File

@@ -2,10 +2,11 @@ package fsdb
import (
"fmt"
"github.com/joho/godotenv"
"os"
"path/filepath"
"time"
"github.com/joho/godotenv"
)
func NewDb(dir string) (db *Db) {

View File

@@ -2,6 +2,7 @@ package fsdb
import (
"fmt"
"github.com/danielmiessler/fabric/common"
goopenai "github.com/sashabaranov/go-openai"
)

View File

@@ -1,8 +1,9 @@
package fsdb
import (
goopenai "github.com/sashabaranov/go-openai"
"testing"
goopenai "github.com/sashabaranov/go-openai"
)
func TestSessions_GetOrCreateSession(t *testing.T) {

View File

@@ -2,6 +2,7 @@ package converter
import (
"bytes"
"github.com/go-shiori/go-readability"
)

View File

@@ -5,13 +5,14 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/danielmiessler/fabric/core"
"github.com/gin-gonic/gin"
"io"
"log"
"net/http"
"strings"
"time"
"github.com/danielmiessler/fabric/core"
"github.com/gin-gonic/gin"
)
type OllamaModel struct {

View File

@@ -2,10 +2,11 @@ package restapi
import (
"fmt"
"github.com/danielmiessler/fabric/plugins/db"
"github.com/gin-gonic/gin"
"io"
"net/http"
"github.com/danielmiessler/fabric/plugins/db"
"github.com/gin-gonic/gin"
)
// StorageHandler defines the handler for storage-related operations