From 72e8fcfeeb98d6b7865cc2d73068a414a98d3b9a Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Tue, 12 Jul 2022 01:17:54 +0200 Subject: [PATCH] Add two initial templates --- README.md | 9 +++++++++ flake.nix | 17 +++++++++++++++++ go1.17/flake.lock | 42 ++++++++++++++++++++++++++++++++++++++++++ go1.17/flake.nix | 39 +++++++++++++++++++++++++++++++++++++++ go1.18/flake.lock | 42 ++++++++++++++++++++++++++++++++++++++++++ go1.18/flake.nix | 39 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 188 insertions(+) create mode 100644 README.md create mode 100644 flake.nix create mode 100644 go1.17/flake.lock create mode 100644 go1.17/flake.nix create mode 100644 go1.18/flake.lock create mode 100644 go1.18/flake.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..2f848f8 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Nix flake templates for easy dev environments + +```shell +# Go 1.17 +nix flake init --template github:the-nix-way/dev-templates go_1_17 + +# Go 1.18 +nix flake init --template github:the-nix-way/dev-templates go_1_18 +``` diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fcff168 --- /dev/null +++ b/flake.nix @@ -0,0 +1,17 @@ +{ + description = "Ready-made templates for easily creating flake-driven environments"; + + outputs = { self }: { + templates = { + go_1_17 = { + path = ./go1.17; + description = "Go 1.17 development environment"; + }; + + go_1_18 = { + path = ./go1.18; + description = "Go 1.18 development environment"; + }; + }; + }; +} diff --git a/go1.17/flake.lock b/go1.17/flake.lock new file mode 100644 index 0000000..a25beee --- /dev/null +++ b/go1.17/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1656928814, + "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1657577542, + "narHash": "sha256-tJnYrGTswnCtz8hXR24y4sZ7d+kgZ7UshnFBcrDjFkU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0a1978fbe48b8bd08be138507e9dade26e5778b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/go1.17/flake.nix b/go1.17/flake.nix new file mode 100644 index 0000000..770e04c --- /dev/null +++ b/go1.17/flake.nix @@ -0,0 +1,39 @@ +{ + description = "Go 1.17 development environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in { + devShells = { + default = pkgs.mkShellNoCC { + buildInputs = with pkgs; [ + # go 1.17.1 + go + + # goimports, godoc, etc. + gotools + + # https://github.com/golangci/golangci-lint + golangci-lint + + # The Go language server (for IDEs and such) + gopls + + # https://pkg.go.dev/github.com/ramya-rao-a/go-outline + go-outline + + # https://github.com/uudashr/gopkgs + gopkgs + ]; + }; + }; + } + ); +} \ No newline at end of file diff --git a/go1.18/flake.lock b/go1.18/flake.lock new file mode 100644 index 0000000..a25beee --- /dev/null +++ b/go1.18/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1656928814, + "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1657577542, + "narHash": "sha256-tJnYrGTswnCtz8hXR24y4sZ7d+kgZ7UshnFBcrDjFkU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0a1978fbe48b8bd08be138507e9dade26e5778b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/go1.18/flake.nix b/go1.18/flake.nix new file mode 100644 index 0000000..da7f1c3 --- /dev/null +++ b/go1.18/flake.nix @@ -0,0 +1,39 @@ +{ + description = "Go 1.17 development environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in { + devShells = { + default = pkgs.mkShellNoCC { + buildInputs = with pkgs; [ + # go 1.18.3 + go_1_18 + + # goimports, godoc, etc. + gotools + + # https://github.com/golangci/golangci-lint + golangci-lint + + # The Go language server (for IDEs and such) + gopls + + # https://pkg.go.dev/github.com/ramya-rao-a/go-outline + go-outline + + # https://github.com/uudashr/gopkgs + gopkgs + ]; + }; + }; + } + ); +} \ No newline at end of file