!QCCCSJHEsTIfozrZxz:nixos.org

Nix + Go

236 Members
Go packaging for and with Nixpkgs. | Be excellent to each other.48 Servers

Load older messages


SenderMessageTime
5 Jan 2024
@faust403:matrix.orgVladislav Vasilev *

Probably, you can quickly help me, because I spent a lot of time with that

I have this default.nix config:

{ stdenv
, pkgs
, lib
}: pkgs.buildGoModule rec {
  name = "neutrond";

  version = "v2.0.0";

  src = (fetchTarball {
    url = "https://github.com/neutron-org/neutron/archive/refs/tags/v2.0.0.tar.gz";
    sha256 = "sha256:04na3ympacdqhk8wbfcq2hk5i2d905ac4fzhgzvf4192nyb0xsin";
  });

  vendorHash = "sha256-uLInKbuL886cfXCyQvIDZJHUC8AK9fR39yNBHDO+Qzc=";
  # vendorHash = lib.fakeSha256;

  doCheck = false;
  

  meta = with lib; {
    description = "Neutron node";

    longDescription = ''
      Neutron node to interact with neutron blockchain
    '';

    homepage = "https://github.com/neutron-org/neutron";
    
    license = licenses.asl20; # Apache license

    maintainers = with maintainers; [
      pr0n00gler
      foxpy
    ];

    platforms = platforms.all;
  };

  nativeBuildInputs = with pkgs; [
    patchelf
    git
    which
    gnumake
  ];


  installPhase = ''
    mkdir -p $out/bin
    go build -mod=readonly -o $out/bin/neutrond ./cmd/neutrond
  '';
}

So, repo https://github.com/neutron-org/neutron/ have a go.mod, which have listed go modules to prefetch. All that stuff we need to build cmd/neutrond dir. But, inside of main.go here we have module that forcing us to fetch other modules during build. So, I have troubles with that "post-fetch" during building

15:24:15
@faust403:matrix.orgVladislav VasilevOf course, if I need to skip post fetching and skip that needness of fetching additional packages, I should list all deps in go.mod, as I suppose15:26:07
@faust403:matrix.orgVladislav VasilevSmells like this repo need cleaning15:26:43
@qbit:tapenet.org@qbit:tapenet.orgso your vendorHash means you are already getting the deps15:26:51
@qbit:tapenet.org@qbit:tapenet.orgyou shouldn't need to specify an installPhase15:27:02
@faust403:matrix.orgVladislav VasilevnativeBuildInputs, as I suppose, also15:27:27
@faust403:matrix.orgVladislav VasilevWhat is a vendor hash at all ? It's nix-hash for src + fetched content aka go modules ?15:28:15
@qbit:tapenet.org@qbit:tapenet.orgvendorHash is the hash of all the dependent modules 15:28:38
@qbit:tapenet.org@qbit:tapenet.org if you look in /nix/store you should see a *-neutrond-go-modules* 15:29:03
@qbit:tapenet.org@qbit:tapenet.org at build that gets tied into the neutrond derivation as a vendor directory 15:29:34
@faust403:matrix.orgVladislav VasilevYe, I see this15:29:34
@faust403:matrix.orgVladislav VasilevSo, its drv for deps15:29:50
@qbit:tapenet.org@qbit:tapenet.orgyour installPhase is probably blocking that from happening15:30:06
@qbit:tapenet.org@qbit:tapenet.orgwhat happens when you remove your installPhase?15:30:13
@faust403:matrix.orgVladislav VasilevNow it fetching deps, I started it, one moment15:30:30
@qbit:tapenet.org@qbit:tapenet.orgi'd probably switch to fetchFromGithub15:31:17
@qbit:tapenet.org@qbit:tapenet.org also version = shouldn't contain the v 15:31:28
@qbit:tapenet.org@qbit:tapenet.org and you can use ${version} and other vars in the derivation in place of the hard-coded strings 15:31:49
@qbit:tapenet.org@qbit:tapenet.org(you are using rec for that)15:31:54
@faust403:matrix.orgVladislav Vasilev
In reply to @qbit:tapenet.org
i'd probably switch to fetchFromGithub
It's like a good manner ?
15:32:02
@qbit:tapenet.org@qbit:tapenet.orgit's more common that fetch tarball - and i have seen tarballs change out (they are cached and get re-gen'd)15:32:43
@faust403:matrix.orgVladislav VasilevOkay, one moment15:33:09
@qbit:tapenet.org@qbit:tapenet.orgtake a look at other packages in the tree 15:33:37
@qbit:tapenet.org@qbit:tapenet.org grep -r buildGoModule 15:33:44
@faust403:matrix.orgVladislav VasilevI already tried, they have no any troubles with deps15:36:12
@faust403:matrix.orgVladislav VasilevI think they are exisiting here because some of deps are not listed in go.mod15:36:32
@faust403:matrix.orgVladislav VasilevSo, they are imported directly15:36:46
@qbit:tapenet.org@qbit:tapenet.orgthen upstream needs to regen go.mod and whatnot 15:36:59
@qbit:tapenet.org@qbit:tapenet.orgwhat's the error?15:37:19
@faust403:matrix.orgVladislav Vasilevshrinking RPATHs of ELF executables and libraries in /nix/store/zzkwzmabvdb6w36ia8acxvzl8aavcnl4-neutrond shrinking /nix/store/zzkwzmabvdb6w36ia8acxvzl8aavcnl4-neutrond/bin/neutrond checking for references to /build/ in /nix/store/zzkwzmabvdb6w36ia8acxvzl8aavcnl4-neutrond... RPATH of binary /nix/store/zzkwzmabvdb6w36ia8acxvzl8aavcnl4-neutrond/bin/neutrond contains a forbidden reference to /build/ /nix/store/d4jf1cbbk494zwgbqz31pxgigpsbh6w2-stdenv-linux/setup: line 74: pop_var_context: head of shell_variables not a function context /nix/store/d4jf1cbbk494zwgbqz31pxgigpsbh6w2-stdenv-linux/setup: line 1414: pop_var_context: head of shell_variables not a function context /nix/store/d4jf1cbbk494zwgbqz31pxgigpsbh6w2-stdenv-linux/setup: line 1553: pop_var_context: head of shell_variables not a function context15:37:40

Show newer messages


Back to Room ListRoom Version: 9