nix-templates/go/flake.nix

35 lines
938 B
Nix
Raw Normal View History

2022-06-11 16:01:36 +01:00
{
description = "Another cool golang abhorration from samw";
2022-06-19 15:20:05 +01:00
inputs.utils.url = "github:numtide/flake-utils";
2022-06-11 16:01:36 +01:00
inputs.devshell = {
url = "github:numtide/devshell";
inputs.flake-utils.follows = "flake-utils";
};
2022-06-19 15:20:05 +01:00
outputs = { self, nixpkgs, utils, devshell }:
utils.lib.eachDefaultSystem (system:
2022-06-11 16:01:36 +01:00
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; };
devShells.default =
2022-06-11 16:01:36 +01:00
pkgs.devshell.mkShell { packages = with pkgs; [ go gopls ]; };
});
}