You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, it's my first time using gomod2nix. My flake builds my hello world main.go, but always hangs for 8 seconds at Building subPackage . It hangs for much longer on a real project I'm attempting to transition. It feels like a setup cost I should be paying once, which is then cached, but it's happening on every code change. Am I doing something wrong?
❯ ls
flake.lock flake.nix go.mod gomod2nix.toml main.go
❯ cat go.mod
module github.com/marcuswhybrow/myproject
go 1.20
❯ cat gomod2nix.toml
schema = 3
[mod]
❯ nix build --verbose --log-format bar-with-logs
this derivation will be built:
/nix/store/pw50p05dxlnnz16j7a9dvq1p29gcr7q0-myproject.drv
building '/nix/store/pw50p05dxlnnz16j7a9dvq1p29gcr7q0-myproject.drv'...
myproject> unpacking sources
myproject> unpacking source archive /nix/store/wycclwg1dgyrhx4j0z6w94ch707cdc8j-golang
myproject> source root is golang
myproject> patching sources
myproject> configuring
myproject> building
myproject> Building subPackage . <-- Hangs here for 8 seconds
myproject> internal/goarch
myproject> internal/unsafeheader
myproject> internal/abi
myproject> internal/cpu
myproject> internal/bytealg
...
My flake.nix is dead simple...
{description="Static Site Generator written in Golang";inputs.nixpkgs.url="github:NixOS/nixpkgs/nixos-unstable";inputs.flake-utils.url="github:numtide/flake-utils";inputs.gomod2nix.url="github:nix-community/gomod2nix";outputs=inputs: inputs.flake-utils.lib.eachDefaultSystem(system: letpkgs=importinputs.nixpkgs{inheritsystem;overlays=[inputs.gomod2nix.overlays.default];};in{packages.default=pkgs.buildGoApplication{name="myproject";pwd=./.;src=./.;modules=./gomod2nix.toml;};devShells.default=pkgs.mkShell{name="myproject";packages=[(pkgs.mkGoEnv{pwd=./.;})pkgs.gomod2nix];};});}
I think these lines are the source of my troubles...
I've also noticed the same thing. Despite the claim that each dependency is cached, building with gomod2nix is noticeably longer than building with the nixpkgs "buildGoModule". I've switched back to that.
Hello, it's my first time using
gomod2nix
. My flake builds my hello worldmain.go
, but always hangs for 8 seconds atBuilding subPackage .
It hangs for much longer on a real project I'm attempting to transition. It feels like a setup cost I should be paying once, which is then cached, but it's happening on every code change. Am I doing something wrong?My
flake.nix
is dead simple...I think these lines are the source of my troubles...
gomod2nix/builder/default.nix
Lines 364 to 367 in 3cbf3a5
Thanks for any suggestions.
The text was updated successfully, but these errors were encountered: