generated from milosgajdos/go-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add nix flake setup * Add reference to nix apps provided by the nix flake Signed-off-by: Milos Gajdos <[email protected]> --------- Signed-off-by: Milos Gajdos <[email protected]>
- Loading branch information
1 parent
c880ff8
commit 50ba631
Showing
6 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ pkgs ? ( | ||
let | ||
inherit (builtins) fetchTree fromJSON readFile; | ||
inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; | ||
in | ||
import (fetchTree nixpkgs.locked) { | ||
overlays = [ | ||
(import "${fetchTree gomod2nix.locked}/overlay.nix") | ||
]; | ||
} | ||
) | ||
, buildGoApplication ? pkgs.buildGoApplication | ||
}: | ||
|
||
buildGoApplication { | ||
pname = "go-embeddings"; | ||
version = "0.1"; | ||
pwd = ./.; | ||
src = ./.; | ||
modules = ./gomod2nix.toml; | ||
doCheck = false; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
description = "go-embeddings nix flake"; | ||
|
||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
inputs.gomod2nix.url = "github:nix-community/gomod2nix"; | ||
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; | ||
inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils"; | ||
|
||
outputs = { self, nixpkgs, flake-utils, gomod2nix }: | ||
(flake-utils.lib.eachDefaultSystem | ||
(system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
|
||
# The current default sdk for macOS fails to compile go projects, so we use a newer one for now. | ||
# This has no effect on other platforms. | ||
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; | ||
in | ||
{ | ||
packages.default = callPackage ./. { | ||
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; | ||
}; | ||
devShells.default = callPackage ./shell.nix { | ||
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix; | ||
}; | ||
apps = { | ||
cohere = { | ||
type = "app"; | ||
program = "${self.packages.${system}.default}/bin/cohere"; | ||
}; | ||
openai = { | ||
type = "app"; | ||
program = "${self.packages.${system}.default}/bin/openai"; | ||
}; | ||
vertexai = { | ||
type = "app"; | ||
program = "${self.packages.${system}.default}/bin/vertexai"; | ||
}; | ||
}; | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
schema = 3 | ||
|
||
[mod] | ||
[mod."cloud.google.com/go/compute"] | ||
version = "v1.20.1" | ||
hash = "sha256-HQvSLdoSagQsuqOb/D9+xMc8nE9Y44Z30rQgd2AGEr8=" | ||
[mod."cloud.google.com/go/compute/metadata"] | ||
version = "v0.2.3" | ||
hash = "sha256-kYB1FTQRdTDqCqJzSU/jJYbVUGyxbkASUKbEs36FUyU=" | ||
[mod."github.com/golang/protobuf"] | ||
version = "v1.5.3" | ||
hash = "sha256-svogITcP4orUIsJFjMtp+Uv1+fKJv2Q5Zwf2dMqnpOQ=" | ||
[mod."golang.org/x/net"] | ||
version = "v0.19.0" | ||
hash = "sha256-3M5rKEvJx4cO/q+06cGjR5sxF5JpnUWY0+fQttrWdT4=" | ||
[mod."golang.org/x/oauth2"] | ||
version = "v0.15.0" | ||
hash = "sha256-exA/abu6WOR7Cwqa41LpnTD2xQNRZMYU5CnBKvXHx8Y=" | ||
[mod."google.golang.org/appengine"] | ||
version = "v1.6.7" | ||
hash = "sha256-zIxGRHiq4QBvRqkrhMGMGCaVL4iM4TtlYpAi/hrivS4=" | ||
[mod."google.golang.org/protobuf"] | ||
version = "v1.31.0" | ||
hash = "sha256-UdIk+xRaMfdhVICvKRk1THe3R1VU+lWD8hqoW/y8jT0=" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ pkgs ? ( | ||
let | ||
inherit (builtins) fetchTree fromJSON readFile; | ||
inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; | ||
in | ||
import (fetchTree nixpkgs.locked) { | ||
overlays = [ | ||
(import "${fetchTree gomod2nix.locked}/overlay.nix") | ||
]; | ||
} | ||
) | ||
, mkGoEnv ? pkgs.mkGoEnv | ||
, gomod2nix ? pkgs.gomod2nix | ||
, golangci-lint ? pkgs.golangci-lint | ||
}: | ||
|
||
let | ||
goEnv = mkGoEnv { pwd = ./.; }; | ||
in | ||
pkgs.mkShell { | ||
packages = [ | ||
goEnv | ||
gomod2nix | ||
golangci-lint | ||
]; | ||
} |