I try to package rook but stumbled upon a go module behavior I don’t know how to fix.
{ lib
, pkgs
, buildGoModule
, fetchFromGitHub
}:
buildGoModule rec {
pname = "rook";
version = "1.13.3";
src = fetchFromGitHub {
owner = "rook";
repo = "rook";
rev = "v${version}";
hash = "sha256-50J0OwuQHHHbAv0qUQNo+2RBFvan4FC+HmqUry+9v0Y=";
};
vendorHash = "sha256-JRnhWcf1lnrzvADL7RPwz/sc0xvP8Ne010QT4edbBDw=";
buildInputs = with pkgs; [
bash
iproute
s5cmd
];
patchPhase = ''
substituteInPlace pkg/operator/ceph/controller/network.go \
--replace "bash" "${pkgs.bash}/bin/bash \
--replace "ip" "${pkgs.iproute}/bin/ip
'';
ldflags = [ "-s" "-w" ];
meta = with lib; {
description = "Storage Orchestration for Kubernetes";
homepage = "https://github.com/rook/rook";
license = licenses.asl20;
maintainers = with maintainers; [ ];
mainProgram = "rook";
};
}
It fail to compile with:
last 10 log lines:
> Building subPackage ./cmd/rook
> Building subPackage ./cmd/rook/ceph
> Building subPackage ./cmd/rook/rook
> Building subPackage ./cmd/rook/userfacing
> Building subPackage ./cmd/rook/userfacing/multus
> Building subPackage ./cmd/rook/userfacing/multus/validation
> Building subPackage ./cmd/rook/util
> Building subPackage ./cmd/rook/version
> Building subPackage ./pkg/apis/ceph.rook.io
> main module (github.com/rook/rook) does not contain package github.com/rook/rook/pkg/apis/ceph.rook.io
So, the package github.com/rook/rook/pkg/apis/ceph.rook.io
does exist, but it is redirected in go.mod
by:
replace github.com/rook/rook/pkg/apis => ./pkg/apis
What is the proper way to fix this ?
The file does exist:
❯ ls -la /nix/store/zzwyzcwdp75g0hmwpdk1p7saasw2k253-source/pkg/apis/
total 69
dr-xr-xr-x 3 nobody nogroup 5 Jan 1 1970 .
dr-xr-xr-x 9 nobody nogroup 9 Jan 1 1970 ..
dr-xr-xr-x 3 nobody nogroup 4 Jan 1 1970 ceph.rook.io
-r--r--r-- 2 nobody nogroup 5067 Jan 1 1970 go.mod
-r--r--r-- 2 nobody nogroup 104895 Jan 1 1970 go.sum