diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fa2721b --- /dev/null +++ b/flake.lock @@ -0,0 +1,41 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1629445995, + "narHash": "sha256-Kc3ro3Df1Wn7p1EkZ1kbJR6UU1U0TB6RKaf+hpXfsys=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4e07a002c3a81cd39dc999d0f98b906fb3a718bd", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1629284811, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c", + "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..7177b24 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = ""; + + inputs = { + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils }: + utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages."${system}"; + lib = pkgs.lib; + in rec { + # `nix build` + packages.telegram = pkgs.buildGoModule rec { + name = "telegram-bot"; + src = ./telegram-bot; + + vendorSha256 = "sha256-NBY2T0Jj5f9XMoc0hleituKHFf+9AFq056a/EpCsuXo="; + }; + defaultPackage = packages.telegram; + + # `nix run` + apps.telegram = utils.lib.mkApp { + drv = packages.telegram; + }; + defaultApp = apps.telegram; + + # `nix develop` + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ go ]; + }; + }); +}