diff --git a/README.md b/README.md index 7512476..cb8cb1b 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,16 @@ Make sure to have Go 1.23.1 installed. make local ``` +### Nix Flake + +```bash +nix build +``` + +Binary will be at `./result/bin/newt` + +Development shell available with `nix develop` + ## Licensing Newt is dual licensed under the AGPLv3 and the Fossorial Commercial license. For inquiries about commercial licensing, please contact us. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c0e3b5c --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1742669843, + "narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e5b653dff12029333a6546c11e108ede13052eb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c196f76 --- /dev/null +++ b/flake.nix @@ -0,0 +1,65 @@ +{ + description = "newt - A tunneling client for Pangolin"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = + { self, nixpkgs }: + let + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgsFor = system: nixpkgs.legacyPackages.${system}; + in + { + packages = forAllSystems ( + system: + let + pkgs = pkgsFor system; + in + { + default = self.packages.${system}.pangolin-newt; + pangolin-newt = pkgs.buildGoModule { + pname = "pangolin-newt"; + version = "1.1.2"; + + src = ./.; + + vendorHash = "sha256-sTtiBBkZ9cuhWnrn2VG20kv4nzNFfdzP5p+ewESCjyM="; + + meta = with pkgs.lib; { + description = "A tunneling client for Pangolin"; + homepage = "https://github.com/fosrl/newt"; + license = licenses.gpl3; + maintainers = [ ]; + }; + }; + } + ); + devShells = forAllSystems ( + system: + let + pkgs = pkgsFor system; + in + { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + go + gopls + gotools + go-outline + gopkgs + godef + golint + ]; + }; + } + ); + }; +}