| 9 Oct 2024 |
Gaétan Lepage | Hi,
I'm packaging a simple go package and it fails with:
src/main.go:14:12: pattern manifest.json: no matching files found
This file indeed uses a go:embed instruction
https://github.com/mikew/nvrh/blob/main/src/main.go#L14 | 13:04:28 |
Gaétan Lepage | I checked and the manifest.json is present in the root of the archive. Why can't it be found then ?
Is the nix go helper doing something weird here ? | 13:05:07 |
Paul Meyer (katexochen) | Gaétan Lepage: Has nothing to do with nix, check https://github.com/mikew/nvrh/blob/main/script/build | 13:08:39 |
Paul Meyer (katexochen) | * Gaétan Lepage: Has nothing to do with nix, check https://github.com/mikew/nvrh/blob/main/script/build#L14. You just need to copy the file from . to ./src | 13:09:19 |
Gaétan Lepage | Indeed thanks a lot ! | 13:10:31 |
| 10 Oct 2024 |
| p4cmanus3r joined the room. | 13:24:34 |
| 11 Oct 2024 |
| netbrain joined the room. | 05:34:29 |
| 16 Oct 2024 |
| @odysee:catgirl.cloud joined the room. | 14:02:41 |
| 17 Oct 2024 |
| Mic92 changed their display name from Mic92 to Mic3000. | 06:51:17 |
| Mic92 changed their display name from Mic3000 to Mic3000 🌋. | 06:51:46 |
| Mic92 changed their display name from Mic3000 🌋 to Mic92. | 12:22:31 |
| 20 Oct 2024 |
| dave seddon joined the room. | 22:56:48 |
dave seddon | anyone had any success with gomod2nix please? I tried posting here: https://discourse.nixos.org/t/gomod2nix-cannot-find-module-providing-package/54558 | 22:57:38 |
| 21 Oct 2024 |
dave seddon | In reply to @galaxyyy:matrix.org
Hello, I am trying to package a Go application however I ran into an error I've never seen before and can't seem to find anything online
github.com/hrfee/jfa-go/docs: is replaced in go.mod, but not marked as replaced in vendor/modules.txt
github.com/hrfee/jfa-go/common: is replaced in go.mod, but not marked as replaced in vendor/modules.txt
github.com/hrfee/jfa-go/ombi: is replaced in go.mod, but not marked as replaced in vendor/modules.txt
github.com/hrfee/jfa-go/logger: is replaced in go.mod, but not marked as replaced in vendor/modules.txt
github.com/hrfee/jfa-go/linecache: is replaced in go.mod, but not marked as replaced in vendor/modules.txt
github.com/hrfee/jfa-go/api: is replaced in go.mod, but not marked as replaced in vendor/modules.txt
github.com/hrfee/jfa-go/easyproxy: is replaced in go.mod, but not marked as replaced in vendor/modules.txt
To ignore the vendor directory, use -mod=readonly or -mod=mod.
To sync the vendor directory, run:
go mod vendor
That is the error I am getting and here is my current derivation
{
lib,
buildGoModule,
fetchFromGitHub,
pkg-config,
libayatana-appindicator,
go-swag,
}:
buildGoModule rec {
pname = "jfa-go";
version = "0.5.1";
src = fetchFromGitHub {
owner = "hrfee";
repo = "jfa-go";
rev = "v${version}";
hash = "sha256-7F0cPTG3LuZQk5AT5V5UwW9+dX25aGS8RDYi62CGDR8=";
};
vendorHash = "sha256-JC9d/FDG6hadkX1ywJ120BAsVkg/xMt9sUkh/DHModI=";
nativeBuildInputs = [
pkg-config
go-swag
];
buildInputs = [
libayatana-appindicator
];
preBuild = ''
swag init -g main.go -d ${src}/
'';
ldflags = [
"-X=main.version=v${version}"
"-X=main.commit=${src.rev}"
"-X=main.updater=binary"
"-X=main.cssVersion=v3"
"-X=main.builtBy=Nix"
];
meta = {
description = "A bit-of-everything user managament app for Jellyfin";
homepage = "https://github.com/hrfee/jfa-go/tree/main";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [saturn745];
mainProgram = "jfa-go";
};
}
Does anybody have any ideas?
Saturn: I believe this means that you DO have a vendor/modules.txt file. e.g. The go.mod and modules.txt are out of sync with each other. Maybe "rm -rf vendor" will fix it? Or "go mod vendor" | 17:33:36 |
Saturn | In reply to @daveseddon:matrix.org Saturn: I believe this means that you DO have a vendor/modules.txt file. e.g. The go.mod and modules.txt are out of sync with each other. Maybe "rm -rf vendor" will fix it? Or "go mod vendor" Actually seems I needed to just set subPackages = ["."] iirc | 17:34:36 |
Saturn | That error ended up not being the one that caused the build to fail and those were more so just warnings | 17:35:03 |
dave seddon | ok. great! Is https://github.com/hrfee/jfa-go/blob/main/Makefile#L35-L42 now up to date with a complete working solution? | 17:36:08 |
Saturn | Yeah for the most part the package works aside from a few small bugs but I'm not sure if those are something to do with my packaging or upstream | 17:37:11 |
Saturn | I would share the derivation file but it looks like I haven't pushed it yet and I'm currently not home | 17:38:14 |
dave seddon | Thanks again. - I'm just trying to understand the "best" way to build go packages with nix. I guess once this is pushed I will try to copy it and make it work for my little project.... Really hoping to use DockerTools to build the docker container with the golangs binary inside it | 17:41:04 |
Saturn | This project in particular seems to do things a bit different especially when it comes to the UI part | 17:41:57 |
dave seddon | I'll be curious to see how it compares to the wiki: https://nixos.wiki/wiki/Go | 17:42:10 |
Saturn | However I can share a basic Telegram bot I have which is built with Nix and I also build a Docker image with Nix containing the package if your interested in looking at that | 17:42:44 |
dave seddon | oh that would be awesome! | 17:45:25 |