diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..aa6c65f --- /dev/null +++ b/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1664281702, + "narHash": "sha256-haixZ4TJLu1Dciow54wrHrHvlGDVr5sW6MTeAV/ZLuI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7e52b35fe98481a279d89f9c145f8076d049d2b9", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c5e9764 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + description = "TodoMVC in Go"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils }: + utils.lib.eachDefaultSystem (system: + let + lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101"; + version = builtins.substring 0 8 lastModifiedDate; + + pkgs = import nixpkgs { + inherit system; + overlays = [ + (final: prev: { + go = prev.go_1_19; + buildGoModule = prev.buildGo118Module; + }) + ]; + }; + + in { + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ go gopls gotools go-tools golangci-lint]; + }; + + defaultPackage = pkgs.buildGoModule { + pname = "todogo"; + inherit version; + + src = ./.; + + vendorSha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="; + }; + }); +}