Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nix): Unable to Compile quantm with Go 1.23 due to gomod2nix and libgit2 version issues #206

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 36 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "quantm.io";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; # TODO: upgrade to 24.11 after pinning libgit2 to 1.7.2
flake-utils.url = "github:numtide/flake-utils";
gomod2nix.url = "github:nix-community/gomod2nix";
gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -14,12 +14,17 @@
outputs = {
nixpkgs,
flake-utils,
gomod2nix,
breu,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {inherit system;};
pkgs = import nixpkgs {
inherit system;
overlays = [gomod2nix.overlays.default];
};

buildGoModule = pkgs.buildGo123Module;

setup = breu.setup.${system};
Expand All @@ -30,37 +35,49 @@
pkgs.http-parser
pkgs.zlib
pkgs.python3 # required for http-parser in libgit2
# use pkgs hash https://lazamar.co.uk/nix-versions/?package=libgit2&version=1.7.2&fullName=libgit2-1.7.2&keyName=libgit2&revision=05bbf675397d5366259409139039af8077d695ce&channel=nixpkgs-unstable#instructions
pkgs.libgit2
];

# Development packages for use in the dev shell
dev = [
pkgs.libpg_query # FIXME: probably not required anymore.
pkgs.gomod2nix
(pkgs.callPackage ./tools/nix/pkgs/sqlc.nix {inherit buildGoModule;})
];

# Set up the development shell with our base and dev packages
shell = setup.shell base dev {};

# Build the quantm binary
quantm = pkgs.stdenv.mkDerivation {
name = "quantm";
# FIXME: cannot build, see https://github.com/nix-community/gomod2nix/pull/168
quantm = pkgs.buildGoApplication {
pname = "quantm";
version = "0.1";
src = ./.;

nativeBuildInputs = base;

buildPhase = ''
export GOROOT=${pkgs.go_1_23}/share/go
export GOCACHE="$TEMPDIR/go-cache"
export GOMODCACHE="$TEMPDIR/go-mod-cache"
go build -x -tags static,system_libgit2 -o ./tmp/quantm ./cmd/quantm
'';

installPhase = ''
mkdir -p $out/bin
cp ./tmp/quantm $out/bin/quantm
'';
modules = ./gomod2nix.toml;
nativeBuildInputs = [pkgs.pkgconf];
subPackages = ["cmd/quantm"];
# go = pkgs.go_1_23;
buildInputs = base;
tags = ["static" "system_libgit2"];
};
# Build the quantm binary
# quantm = pkgs.stdenv.mkDerivation {
# name = "quantm";
# src = ./.;
# nativeBuildInputs = [pkgs.pkgconf];
# buildInputs = base;
# buildPhase = ''
# export GOROOT=${pkgs.go_1_23}/share/go
# export HOME=$(pwd)
# echo go env
# go build -tags static,system_libgit2 -o ./tmp/quantm ./cmd/quantm
# '';
# installPhase = ''
# mkdir -p $out/bin
# cp ./tmp/quantm $out/bin/quantm
# '';
# };
in {
devShells.default = shell;
packages.quantm = quantm;
Expand Down
53 changes: 25 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ module go.breu.io/quantm
go 1.23.1

require (
connectrpc.com/connect v1.17.0
github.com/ClickHouse/clickhouse-go/v2 v2.30.0
connectrpc.com/connect v1.18.1
github.com/ClickHouse/clickhouse-go/v2 v2.30.1
github.com/avast/retry-go/v4 v4.6.0
github.com/bradleyfalzon/ghinstallation/v2 v2.12.0
github.com/go-git/go-git/v5 v5.12.0
github.com/bradleyfalzon/ghinstallation/v2 v2.13.0
github.com/go-git/go-git/v5 v5.13.1
github.com/go-jose/go-jose/v4 v4.0.4
github.com/gobeam/stringy v0.0.7
github.com/gocql/gocql v1.7.0
github.com/google/go-github/v62 v62.0.0
github.com/gosimple/slug v1.15.0
github.com/jackc/pgx/v5 v5.7.2
Expand All @@ -24,32 +23,34 @@ require (
github.com/stretchr/testify v1.10.0
go.breu.io/durex v0.6.2
go.breu.io/graceful v0.1.0
go.opentelemetry.io/otel/trace v1.33.0
go.step.sm/crypto v0.56.0
go.temporal.io/sdk v1.31.0
golang.org/x/crypto v0.31.0
golang.org/x/net v0.33.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8
go.opentelemetry.io/otel/trace v1.34.0
go.step.sm/crypto v0.57.0
go.temporal.io/sdk v1.32.1
golang.org/x/crypto v0.32.0
golang.org/x/net v0.34.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20250122153221-138b5a5a4fd4
)

require github.com/google/go-github/v68 v68.0.0 // indirect

require (
cloud.google.com/go/compute/metadata v0.6.0
dario.cat/mergo v1.0.1 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/ClickHouse/ch-go v0.61.5 // indirect
github.com/ClickHouse/ch-go v0.63.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.7.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-billy/v5 v5.6.1 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
github.com/go-test/deep v1.0.8 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
Expand All @@ -58,22 +59,19 @@ require (
github.com/golang-migrate/migrate/v4 v4.18.1
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-github/v66 v66.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/lib/pq v1.10.9 // indirect
Expand All @@ -92,25 +90,24 @@ require (
github.com/segmentio/asm v1.2.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/slack-go/slack v0.15.0
github.com/stretchr/objx v0.5.2 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
go.opentelemetry.io/otel v1.33.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
go.temporal.io/api v1.43.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.8.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f // indirect
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.36.1
gopkg.in/inf.v0 v0.9.1 // indirect
golang.org/x/time v0.9.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
google.golang.org/grpc v1.69.4
google.golang.org/protobuf v1.36.3
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading
Loading