mirror of
				https://github.com/wlcx/nix-templates.git
				synced 2025-11-04 04:13:45 +00:00 
			
		
		
		
	Add golang template
This commit is contained in:
		
							parent
							
								
									85999ed2cf
								
							
						
					
					
						commit
						114bfcbf80
					
				@ -9,6 +9,10 @@
 | 
			
		||||
          path = ./rust;
 | 
			
		||||
          description = "My preferred rust setup.";
 | 
			
		||||
        };
 | 
			
		||||
        go = {
 | 
			
		||||
          path = ./go;
 | 
			
		||||
          description = "My preferred go setup.";
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    } // utils.lib.eachDefaultSystem (system:
 | 
			
		||||
      let pkgs = import nixpkgs { inherit system; };
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										34
									
								
								go/flake.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								go/flake.nix
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
{
 | 
			
		||||
  description = "Another cool golang abhorration from samw";
 | 
			
		||||
 | 
			
		||||
  inputs.flake-utils.url = "github:numtide/flake-utils";
 | 
			
		||||
  inputs.devshell = {
 | 
			
		||||
    url = "github:numtide/devshell";
 | 
			
		||||
    inputs.flake-utils.follows = "flake-utils";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs = { self, nixpkgs, flake-utils, devshell }:
 | 
			
		||||
    flake-utils.lib.eachDefaultSystem (system:
 | 
			
		||||
      let
 | 
			
		||||
        pkgs = import nixpkgs {
 | 
			
		||||
          inherit system;
 | 
			
		||||
          overlays = [ devshell.overlay ];
 | 
			
		||||
        };
 | 
			
		||||
      in rec {
 | 
			
		||||
        packages.default = pkgs.buildGoModule {
 | 
			
		||||
          name = "my-project";
 | 
			
		||||
          src = self;
 | 
			
		||||
          vendorSha256 = "";
 | 
			
		||||
 | 
			
		||||
          # Inject the git version if you want
 | 
			
		||||
          #ldflags = ''
 | 
			
		||||
          #  -X main.version=${if self ? rev then self.rev else "dirty"}
 | 
			
		||||
          #'';
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        apps.default = utils.lib.mkApp { drv = packages.default; };
 | 
			
		||||
 | 
			
		||||
        devShell =
 | 
			
		||||
          pkgs.devshell.mkShell { packages = with pkgs; [ go gopls ]; };
 | 
			
		||||
      });
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user