summaryrefslogtreecommitdiff
path: root/common/templates/go/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'common/templates/go/flake.nix')
-rw-r--r--common/templates/go/flake.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/common/templates/go/flake.nix b/common/templates/go/flake.nix
new file mode 100644
index 0000000..3f8e7d5
--- /dev/null
+++ b/common/templates/go/flake.nix
@@ -0,0 +1,49 @@
+{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+
+ outputs =
+ {
+ self,
+ nixpkgs,
+ ...
+ }:
+ let
+ inherit (nixpkgs) lib;
+ forAllSystems = lib.genAttrs lib.systems.flakeExposed;
+ in
+ {
+ packages = forAllSystems (
+ system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ in
+ {
+ default = pkgs.buildGoModule {
+ pname = "hello_go";
+ version = "0.0.1";
+ src = self;
+
+ # The "Trust but Verify" hash.
+ vendorHash = null;
+ };
+ }
+ );
+
+ devShells = forAllSystems (
+ system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ in
+ {
+ default = pkgs.mkShellNoCC {
+ packages = with pkgs; [
+ go
+ gopls
+ gotools
+ go-tools
+ ];
+ };
+ }
+ );
+ };
+}