Skip to content

Commit 1f765c5

Browse files
committed
flake: fix/update
1 parent f9395fa commit 1f765c5

31 files changed

+72
-45
lines changed

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
watch_file shell.nix
1+
watch_file nix/shell.nix
22
use flake

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ jobs:
2222
- name: Checkout code
2323
uses: actions/checkout@v4
2424

25+
- name: Install Nix
26+
uses: DeterminateSystems/nix-installer-action@main
27+
2528
- name: Set up Go
2629
uses: actions/setup-go@v4
2730
with:
2831
go-version-file: ./go.mod
2932

3033
- name: Run tests
3134
run: go test -v ./...
35+
36+
- name: Check Formatting
37+
run: nix flake check

.github/workflows/update-version-and-create-tag.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
- name: Install Nix
2626
uses: DeterminateSystems/nix-installer-action@main
2727

28-
- name: Setup Nix Cache
29-
uses: DeterminateSystems/magic-nix-cache-action@main
30-
3128
- name: Set up Git
3229
run: |
3330
git config user.name "github-actions[bot]"
@@ -63,21 +60,21 @@ jobs:
6360
6461
- name: Update version.nix file
6562
run: |
66-
echo "\"${{ env.new_version }}\"" > pkgs/fabric/version.nix
63+
echo "\"${{ env.new_version }}\"" > nix/pkgs/fabric/version.nix
6764
68-
- name: Format source codes
65+
- name: Format source code
6966
run: |
70-
go fmt ./...
67+
nix fmt
7168
7269
- name: Update gomod2nix.toml file
7370
run: |
74-
nix run .#gomod2nix
71+
nix run .#gomod2nix -- --outdir nix/pkgs/fabric
7572
7673
- name: Commit changes
7774
run: |
7875
git add version.go
79-
git add pkgs/fabric/version.nix
80-
git add gomod2nix.toml
76+
git add nix/pkgs/fabric/version.nix
77+
git add nix/pkgs/fabric/gomod2nix.toml
8178
git add .
8279
if ! git diff --staged --quiet; then
8380
git commit -m "Update version to ${{ env.new_tag }} and commit $commit_hash"

cli/cli_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package cli
22

33
import (
4-
"github.com/danielmiessler/fabric/core"
54
"os"
65
"testing"
76

7+
"github.com/danielmiessler/fabric/core"
8+
89
"github.com/stretchr/testify/assert"
910
)
1011

cli/output.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package cli
22

33
import (
44
"fmt"
5-
"github.com/atotto/clipboard"
65
"os"
6+
7+
"github.com/atotto/clipboard"
78
)
89

910
func CopyToClipboard(message string) (err error) {

common/attachment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import (
66
"encoding/base64"
77
"encoding/json"
88
"fmt"
9-
"github.com/gabriel-vasile/mimetype"
109
"io/ioutil"
1110
"net/http"
1211
"os"
1312
"path/filepath"
13+
14+
"github.com/gabriel-vasile/mimetype"
1415
)
1516

1617
type Attachment struct {

common/domain_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package common
22

33
import (
4+
"testing"
5+
46
goopenai "github.com/sashabaranov/go-openai"
57
"github.com/stretchr/testify/assert"
6-
"testing"
78
)
89

910
func TestNormalizeMessages(t *testing.T) {

common/groups_items.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package common
22

33
import (
44
"fmt"
5+
56
"github.com/samber/lo"
67
)
78

core/plugin_registry.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package core
33
import (
44
"bytes"
55
"fmt"
6-
"github.com/danielmiessler/fabric/plugins/ai/exolab"
76
"os"
87
"path/filepath"
98
"strconv"
109

10+
"github.com/danielmiessler/fabric/plugins/ai/exolab"
11+
1112
"github.com/samber/lo"
1213

1314
"github.com/danielmiessler/fabric/common"

flake.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
let
3434
pkgs = nixpkgs.legacyPackages.${system};
3535
in
36-
treefmt-nix.lib.evalModule pkgs ./treefmt.nix
36+
treefmt-nix.lib.evalModule pkgs ./nix/treefmt.nix
3737
);
3838
in
3939
{
@@ -49,7 +49,7 @@
4949
pkgs = nixpkgs.legacyPackages.${system};
5050
goEnv = gomod2nix.legacyPackages.${system}.mkGoEnv { pwd = ./.; };
5151
in
52-
import ./shell.nix {
52+
import ./nix/shell.nix {
5353
inherit pkgs goEnv;
5454
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;
5555
}
@@ -62,7 +62,7 @@
6262
in
6363
{
6464
default = self.packages.${system}.fabric;
65-
fabric = pkgs.callPackage ./pkgs/fabric {
65+
fabric = pkgs.callPackage ./nix/pkgs/fabric {
6666
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
6767
};
6868
inherit (gomod2nix.legacyPackages.${system}) gomod2nix;

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package main
22

33
import (
44
"fmt"
5-
"github.com/jessevdk/go-flags"
65
"os"
76

7+
"github.com/jessevdk/go-flags"
8+
89
"github.com/danielmiessler/fabric/cli"
910
)
1011

pkgs/fabric/default.nix renamed to nix/pkgs/fabric/default.nix

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
buildGoApplication {
77
pname = "fabric-ai";
88
version = import ./version.nix;
9-
src = ../../.;
10-
pwd = ../../.;
11-
modules = ../../gomod2nix.toml;
9+
src = ../../../.;
10+
pwd = ../../../.;
11+
modules = ./gomod2nix.toml;
12+
13+
doCheck = false;
1214

1315
ldflags = [
1416
"-s"
File renamed without changes.
File renamed without changes.

shell.nix renamed to nix/shell.nix

File renamed without changes.

treefmt.nix renamed to nix/treefmt.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
statix.enable = true;
77
nixfmt.enable = true;
88

9+
goimports.enable = true;
910
gofmt.enable = true;
1011
};
1112
}

plugins/ai/azure/azure.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package azure
22

33
import (
4+
"strings"
5+
46
"github.com/danielmiessler/fabric/plugins"
57
"github.com/danielmiessler/fabric/plugins/ai/openai"
68
goopenai "github.com/sashabaranov/go-openai"
7-
"strings"
89
)
910

1011
func NewClient() (ret *Client) {

plugins/ai/dryrun/dryrun_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package dryrun
22

33
import (
4-
"github.com/danielmiessler/fabric/common"
5-
"github.com/sashabaranov/go-openai"
64
"reflect"
75
"testing"
6+
7+
"github.com/danielmiessler/fabric/common"
8+
"github.com/sashabaranov/go-openai"
89
)
910

1011
// Test generated using Keploy

plugins/ai/exolab/exolab.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package exolab
22

33
import (
4+
"strings"
5+
46
"github.com/danielmiessler/fabric/plugins"
57
"github.com/danielmiessler/fabric/plugins/ai/openai"
6-
"strings"
78

89
goopenai "github.com/sashabaranov/go-openai"
910
)

plugins/ai/gemini/gemini.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"strings"
8+
79
"github.com/danielmiessler/fabric/plugins"
810
goopenai "github.com/sashabaranov/go-openai"
9-
"strings"
1011

1112
"github.com/danielmiessler/fabric/common"
1213
"github.com/google/generative-ai-go/genai"

plugins/ai/gemini/gemini_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package gemini
22

33
import (
4-
"github.com/google/generative-ai-go/genai"
54
"testing"
5+
6+
"github.com/google/generative-ai-go/genai"
67
)
78

89
// Test generated using Keploy

plugins/ai/openai/openai.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"github.com/danielmiessler/fabric/plugins"
87
"io"
98
"log/slog"
109

10+
"github.com/danielmiessler/fabric/plugins"
11+
1112
"github.com/danielmiessler/fabric/common"
1213
"github.com/samber/lo"
1314
"github.com/sashabaranov/go-openai"

plugins/ai/vendor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package ai
22

33
import (
44
"context"
5+
56
"github.com/danielmiessler/fabric/plugins"
67
goopenai "github.com/sashabaranov/go-openai"
78

plugins/ai/vendors.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
"github.com/danielmiessler/fabric/plugins"
87
"sync"
8+
9+
"github.com/danielmiessler/fabric/plugins"
910
)
1011

1112
func NewVendorsManager() *VendorsManager {

plugins/db/fsdb/db.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package fsdb
22

33
import (
44
"fmt"
5-
"github.com/joho/godotenv"
65
"os"
76
"path/filepath"
87
"time"
8+
9+
"github.com/joho/godotenv"
910
)
1011

1112
func NewDb(dir string) (db *Db) {

plugins/db/fsdb/sessions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package fsdb
22

33
import (
44
"fmt"
5+
56
"github.com/danielmiessler/fabric/common"
67
goopenai "github.com/sashabaranov/go-openai"
78
)

plugins/db/fsdb/sessions_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package fsdb
22

33
import (
4-
goopenai "github.com/sashabaranov/go-openai"
54
"testing"
5+
6+
goopenai "github.com/sashabaranov/go-openai"
67
)
78

89
func TestSessions_GetOrCreateSession(t *testing.T) {

plugins/tools/converter/html_readability.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package converter
22

33
import (
44
"bytes"
5+
56
"github.com/go-shiori/go-readability"
67
)
78

restapi/ollama.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import (
55
"context"
66
"encoding/json"
77
"fmt"
8-
"github.com/danielmiessler/fabric/core"
9-
"github.com/gin-gonic/gin"
108
"io"
119
"log"
1210
"net/http"
1311
"strings"
1412
"time"
13+
14+
"github.com/danielmiessler/fabric/core"
15+
"github.com/gin-gonic/gin"
1516
)
1617

1718
type OllamaModel struct {

0 commit comments

Comments
 (0)