Capnproto CLI missing /std for go-capnp project


I’m currently looking to build an overengineered project for the sake of learning these technologies and I’m currently running into the problem of compiling capnproto for my golang projectwhen using Nix.

Here is the flake:

  description = "bump rockets, make whoosh";                                                                                                                                                                                                                                                                 
  inputs = {                                                                                                                                                                                                                                                                                                 
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";                                                                                                                                                                                                                                                   
    templ.url = "github:a-h/templ";                                                                                                                                                                                                                                                                          
  outputs = { self, nixpkgs, templ, ... }:                                                                                                                                                                                                                                                                   
      supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];                                                                                                                                                                                                                
      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;                                                                                                                                                                                                                                                 
      nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });                                                                                                                                                                                                                               
      packages = forAllSystems (system:                                                                                                                                                                                                                                                                      
          pkgs = nixpkgsFor.${system};                                                                                                                                                                                                                                                                       
          go-capnp = pkgs.fetchFromGitHub {                                                                                                                                                                                                                                                                  
            name = "go-capnp";                                                                                                                                                                                                                                                                               
            owner = "capnproto";                                                                                                                                                                                                                                                                             
            repo = "go-capnp";                                                                                                                                                                                                                                                                               
            rev = "main";                                                                                                                                                                                                                                                                                    
            hash = "sha256-P6YP5b5Bz5/rS1ulkt1tSr3mhLyxxwgCin4WRFErPGM=";                                                                                                                                                                                                                                    
        in rec                                                                                                                                                                                                                                                                                               
          capnpc-go = pkgs.buildGoModule {                                                                                                                                                                                                                                                                   
            name = "capnpc-go";                                                                                                                                                                                                                                                                              
            pname = "capnpc-go";                                                                                                                                                                                                                                                                             
            src = go-capnp;                                                                                                                                                                                                                                                                                  
            sourceRoot = "go-capnp";                                                                                                                                                                                                                                                                         
            vendorSha256 = "sha256-DRNbv+jhIHzoBItuiQykrp/pD/46uysFbazLJ59qbqY=";                                                                                                                                                                                                                            
            buildPhase = ''                                                                                                                                                                                                                                                                                  
              go install ./capnpc-go                                                                                                                                                                                                                                                                         
          rocket_crash = pkgs.stdenv.mkDerivation {                                                                                                                                                                                                                                                          
            name = "rocket_crash";                                                                                                                                                                                                                                                                           
            pname = "rocket_crash";                                                                                                                                                                                                                                                                          
            version = builtins.substring 0 8 (self.lastModifiedDate or "19700101");                                                                                                                                                                                                                          
            srcs = [                                                                                                                                                                                                                                                                                         
            GOMAXPROCS = "1";                                                                                                                                                                                                                                                                                
            sourceRoot = "rocket_crash-src/";                                                                                                                                                                                                                                                                
            preConfigure = ''                                                                                                                                                                                                                                                                                
              export XDG_CACHE_HOME=$TMPDIR/.cache                                                                                                                                                                                                                                                           
              export GOPATH=$XDG_CACHE_HOME/go                                                                                                                                                                                                                                                               
            shellHook = ''                                                                                                                                                                                                                                                                                   
              echo "called shellhook for dev"                                                                                                                                                                                                                                                                
              export CAPNPC_GO_STD="${capnpc-go}"                                                                                                                                                                                                                                                            
              echo "${capnpc-go}"                                                                                                                                                                                                                                                                            
            configureFlags = [                                                                                                                                                                                                                                                                               
            nativeBuildInputs = with pkgs; [                                                                                                                                                                                                                                                                 
      defaultPackage = forAllSystems (system: self.packages.${system}.rocket_crash);                                                                                                                                                                                                                         

I’m able to compile and run the flake using nix develop just fine. The issue I have is with the command shared in the example README from go-capnp. Where they mention the /std directory.

I’m unsure of where this is supposed to reside in NixOS and how to access it. In the gist, you can see that I attempted to assign it via the env variable GO_CAPNP_STD. But had zero luck.

My question is whether I’m thinking about where it resides incorrectly and how to go about debugging this within nix.

Note: I’ve been referencing material online fairly heavily and so there may be artefacts that aren’t necessary in this flake. If you notice any, please do let me know.

TL;DR - Can’t find capnpc-go/std as referenced in the gist when issuing capnp compile -I command.

In case anyone runs into the same problem as I did. The issue was with the implementation of my shellHook:

shellHook = ‘’
    export CAPNPC_GO_STC=“${capnpc-go.src}/std”

In my case, I was referring to the default output of the package. Whereas with src I was referring to the source code of the package. Which is where the directory /std