!QCCCSJHEsTIfozrZxz:nixos.org

Nix + Go

238 Members
Go packaging for and with Nixpkgs. | Be excellent to each other.49 Servers

Load older messages


SenderMessageTime
5 Jan 2024
@qbit:tapenet.org@qbit:tapenet.orglike when building a derivation? 15:12:29
@faust403:matrix.orgVladislav VasilevOriginally, GOPROXY was off, but I setted it to export GOPROXY=proxy.golang.org15:12:36
@faust403:matrix.orgVladislav Vasilev
In reply to @qbit:tapenet.org
like when building a derivation?
yep
15:12:41
@qbit:tapenet.org@qbit:tapenet.orgbuilds happen sandboxed - so no network15:12:42
@faust403:matrix.orgVladislav VasilevI turned off sandbox15:12:55
@qbit:tapenet.org@qbit:tapenet.orgi think it's more than the sandbox that blocks the network15:13:20
@faust403:matrix.orgVladislav VasilevOr15:13:23
@qbit:tapenet.org@qbit:tapenet.orgyou don't want network access at all15:13:25
@faust403:matrix.orgVladislav VasilevOne moment15:13:28
@faust403:matrix.orgVladislav VasilevProbably you are right15:13:38
@qbit:tapenet.org@qbit:tapenet.orgbecause it can result in non-reproducible things15:13:42
@faust403:matrix.orgVladislav VasilevSo, go retrieving go modules from the internet. I always thought that sometimes it's necessary to have an access to internet15:14:59
@qbit:tapenet.org@qbit:tapenet.orgthe way the buildGoModule stuff works is it first builds a list of vendor'd deps, (vendorHash) then you supply that hash to your buildGoModule derivation 15:15:48
@faust403:matrix.orgVladislav VasilevBut, if I want to add it to nixpkgs repo, I should solve it anyway. I need to prefetch some packages or what?15:16:24
@faust403:matrix.orgVladislav VasilevHm15:16:32
@qbit:tapenet.org@qbit:tapenet.orgwhat i am describing does the "pre-fetch" so to speak15:16:42
@faust403:matrix.orgVladislav VasilevHere is a strange package btw15:16:42
@qbit:tapenet.org@qbit:tapenet.orghow so?15:17:04
@faust403:matrix.orgVladislav VasilevFor example, first trouble that I got was hard coded go version15:17:47
@faust403:matrix.orgVladislav VasilevSo, buildGo120Module using 1.20.12 version, but package requiring from Makefile exactly 1.20 version15:18:17
@qbit:tapenet.org@qbit:tapenet.orgyou shouldn't need to use the makefile15:18:37
@qbit:tapenet.org@qbit:tapenet.orglink to the repo in question? 15:18:50
@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 we should fetch again. So, I have troubles with that "post-fetch" during building

15:23:07
@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

Show newer messages


Back to Room ListRoom Version: 9