!QCCCSJHEsTIfozrZxz:nixos.org

Nix + Go

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

Load older messages


SenderMessageTime
23 Apr 2024
@qbit:tapenet.org@qbit:tapenet.orgbut saving it for usage elsewhere..13:37:55
@katexochen:matrix.orgPaul Meyer (katexochen)It is not weird, commonly done to run integration tests etc. Especially when building with nix, it allows running integration tests outside the sandbox.16:51:01
@katexochen:matrix.orgPaul Meyer (katexochen)At work we have a modified version of buildGoModule. Sadly overriding phases isn't possibly/easy, IIRC we copy most of the builder to make the modification.16:52:44
@katexochen:matrix.orgPaul Meyer (katexochen)* At work we have a modified version of buildGoModule for this. Sadly overriding phases isn't possibly/easy, IIRC we copy most of the builder to make the modification.16:53:06
@qbit:tapenet.org@qbit:tapenet.orgfirst time I have encountered it17:04:39
@dnrix:matrix.orgdnrThe specific reason in this case I need to run the test binary as root and I don't want to run the whole toolchain as root. Also I want to copy it to another system22:59:25
24 Apr 2024
@katexochen:matrix.orgPaul Meyer (katexochen)
In reply to @dnrix:matrix.org
I want to build a package with the binary of one of my tests (using the go testing framework). I'm using buildGoModule for everything else so I'd like to use that too. I thought this would be easy but the best I could figure out was to use buildGoModule and then just override buildPhase = "go test -c -o mytest ./mytest"; (and then installPhase to copy it into $out). That works but I'm missing things like tags and other build flags. I can add those back but it's starting to feel a little wrong.. is there a better way to do this?

looked it up, we copy buildPhase and make the following two changes:

@@ -26,7 +26,7 @@
       fi
 
       local OUT
-      if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
+      if ! OUT="$(go $cmd -c -o $GOPATH/bin/ "''${flags[@]}" $dir 2>&1)"; then
         if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
           echo "$OUT" >&2
           return 1
@@ -62,5 +62,5 @@
     fi
     for pkg in $(getGoDirs ""); do
       echo "Building subPackage $pkg"
-      buildGoDir install "$pkg"
+      buildGoDir test "$pkg"
     done
05:50:29
@easel:matrix.orgeasel joined the room.22:01:41
26 Apr 2024
@diamondburned:matrix.orgDiamond (it/she) changed their profile picture.04:18:43
@federicodschonborn:matrix.orgFederico Damián Schonborn changed their profile picture.14:48:30
@svrana:matrix.orgsvrana joined the room.16:00:58
27 Apr 2024
@withoutwithin:matrix.orgXe Iaso left the room.16:03:56
28 Apr 2024
@federicodschonborn:matrix.orgFederico Damián Schonborn changed their profile picture.22:47:17
@federicodschonborn:matrix.orgFederico Damián Schonborn left the room.23:13:59
29 Apr 2024
@anjoletto:matrix.orgleonardo joined the room.01:46:50
@anthr76:mozilla.organthr76Hey y'all I'm trying to use the externalPlugins with coredns. I can'02:38:45
@anthr76:mozilla.organthr76 * Hey y'all I'm trying to use the externalPlugins with coredns. I can't seem to add coredns-tailscale or coredns-blocklist 02:39:02
@anthr76:mozilla.organthr76 *

Hey y'all I'm trying to use the externalPlugins with coredns. I can't seem to add coredns-tailscale or coredns-blocklist.

This is the error I'm seeing https://gist.github.com/anthr76/5d5f43ecc2791c1d1859a6d0dcaf0b67

This is what my code looks like:

02:39:53
@anthr76:mozilla.organthr76 *

Hey y'all I'm trying to use the externalPlugins with coredns. I can't seem to add coredns-tailscale or coredns-blocklist.

This is the error I'm seeing https://gist.github.com/anthr76/5d5f43ecc2791c1d1859a6d0dcaf0b67

This is what my code looks like:

    package = (pkgs.coredns.override {
      externalPlugins = [
        {
          name = "k8s_gateway";
          repo = "github.com/ori-edge/k8s_gateway";
          version = "3645f683ae8ccebf8eae21d675874d8f8f7b54fa";
        }
        {
          name = "coredns-blocklist";
          repo = "github.com/relekang/coredns-blocklist";
          version = "6351d9fa5b2015074521df1684185d9b6607ae97";
        }
        {
          name = "coredns-tailscale";
          repo = "github.com/damomurf/coredns-tailscale";
          version = "750df081a3cc63f325ecfde6c30a974dc0e4bf56";
        }
      ];
      vendorHash = "";
02:40:10
@anthr76:mozilla.organthr76I've had no problems with k8s_gateway. Anyone have any suggestions or see anything glaring wrong? 02:41:10
@diamondburned:matrix.orgDiamond (it/she) could you try overrideAttrs-ing that with modBuildPhase = (old.modBuildPhase) + "go mod tidy && go mod vendor"? 02:54:22
@anthr76:mozilla.organthr76 Great idea. I’ll give it a go tomorrow more int 03:07:36
@anthr76:mozilla.organthr76 * Great idea. I’ll give it a go tomorrow morning 03:07:42
@anthr76:mozilla.organthr76
In reply to @diamondburned:matrix.org
could you try overrideAttrs-ing that with modBuildPhase = (old.modBuildPhase) + "go mod tidy && go mod vendor"?

I ended up seeing the same error :(

Which doesn't make much sense because I see the plugins are down before hand

12:34:19
@anthr76:mozilla.organthr76
In reply to @diamondburned:matrix.org
could you try overrideAttrs-ing that with modBuildPhase = (old.modBuildPhase) + "go mod tidy && go mod vendor"?
*

I ended up seeing the same error :(

Which doesn't make much sense because I see the plugins are down before hand https://github.com/NixOS/nixpkgs/blob/58a1abdbae3217ca6b702f03d3b35125d88a2994/pkgs/servers/dns/coredns/default.nix#L33

12:34:21
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:28:52
@fudgemaster:matrix.orgMaster Fudge joined the room.17:16:43
@fudgemaster:matrix.orgMaster Fudge changed their display name from Frank Geusch to Master Fudge.17:28:05
@anthr76:mozilla.organthr76

I've opened a bug report here https://github.com/NixOS/nixpkgs/issues/307750

I also tried taking a overlay approach in a more manual manner to understand what's breaking where but it seems like my modBuildPhase isn't detected

  modifications = final: prev: {
    coredns-snowflake = prev.coredns.overrideAttrs (oldAttrs: {
        vendorHash = "";
        modBuildPhase = (oldAttrs.modBuildPhase) + ''
          echo blocklist:github.com/relekang/coredns-blocklist >> plugin.cfg
          echo tailscale:github.com/damomurf/coredns-tailscale >> plugin.cfg
          echo k8s_gateway:github.com/ori-edge/k8s_gateway >> plugin.cfg
          go mod tidy
          go mod vendor
          GOOS= GOARCH= go generate
          go mod tidy
          go mod vendor
      '';
    });
  };
18:41:20
1 May 2024
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:06:38

Show newer messages


Back to Room ListRoom Version: 9