From d981a82b1c02b4c5aea0727a68be0cb21d438c77 Mon Sep 17 00:00:00 2001 From: Varun Narravula Date: Wed, 3 Dec 2025 14:57:45 -0800 Subject: [PATCH 1/7] chore(nix): use nixpkgs-unstable branch and update flake inputs --- flake.lock | 8 ++++---- flake.nix | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 41ae270..1f73496 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1756217674, - "narHash": "sha256-TH1SfSP523QI7kcPiNtMAEuwZR3Jdz0MCDXPs7TS8uo=", + "lastModified": 1763934636, + "narHash": "sha256-9glbI7f1uU+yzQCq5LwLgdZqx6svOhZWkd4JRY265fc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4e7667a90c167f7a81d906e5a75cba4ad8bee620", + "rev": "ee09932cedcef15aaf476f9343d1dea2cb77e261", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-25.05", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 4cbbdd8..f87ca0b 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "newt - A tunneling client for Pangolin"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; outputs = @@ -40,7 +40,7 @@ pname = "pangolin-newt"; version = version; src = srcWithReplacedVersion; - vendorHash = "sha256-PENsCO2yFxLVZNPgx2OP+gWVNfjJAfXkwWS7tzlm490="; + vendorHash = "sha256-iLUeQ16KLRPdAZT3DCe4eGjlqPrNJJ27BNLtTpeQlC0="; meta = with pkgs.lib; { description = "A tunneling client for Pangolin"; homepage = "https://github.com/fosrl/newt"; From c7d656214f40ba168a8cb0c857e9dd54302eb59a Mon Sep 17 00:00:00 2001 From: Varun Narravula Date: Wed, 3 Dec 2025 15:50:36 -0800 Subject: [PATCH 2/7] fix(nix): replace version string sub with ldflags, use gitignore on src --- flake.nix | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index f87ca0b..19301a4 100644 --- a/flake.nix +++ b/flake.nix @@ -25,22 +25,21 @@ # Update version when releasing version = "1.4.2"; - - # Update the version in a new source tree - srcWithReplacedVersion = pkgs.runCommand "newt-src-with-version" { } '' - cp -r ${./.} $out - chmod -R +w $out - rm -rf $out/.git $out/result $out/.envrc $out/.direnv - sed -i "s/version_replaceme/${version}/g" $out/main.go - ''; in { default = self.packages.${system}.pangolin-newt; + pangolin-newt = pkgs.buildGoModule { pname = "pangolin-newt"; - version = version; - src = srcWithReplacedVersion; + inherit version; + src = pkgs.nix-gitignore.gitignoreSource [ ] ./.; + vendorHash = "sha256-iLUeQ16KLRPdAZT3DCe4eGjlqPrNJJ27BNLtTpeQlC0="; + + ldflags = [ + "-X main.newtVersion=${version}" + ]; + meta = with pkgs.lib; { description = "A tunneling client for Pangolin"; homepage = "https://github.com/fosrl/newt"; From 09568c1aaf0884062b29c521840eb8ec1135693d Mon Sep 17 00:00:00 2001 From: Varun Narravula Date: Wed, 3 Dec 2025 23:35:59 -0500 Subject: [PATCH 3/7] fix(nix): use correct hash for vendored deps --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 19301a4..74aea6f 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,7 @@ inherit version; src = pkgs.nix-gitignore.gitignoreSource [ ] ./.; - vendorHash = "sha256-iLUeQ16KLRPdAZT3DCe4eGjlqPrNJJ27BNLtTpeQlC0="; + vendorHash = "sha256-Jbu0pz+okV4N9MHUXLcTqSr3s/k5OVZ09hNuS/+4LFY="; ldflags = [ "-X main.newtVersion=${version}" From 8db50d94c0e417672263a8dd97bbc3b62be4ceeb Mon Sep 17 00:00:00 2001 From: Varun Narravula Date: Wed, 3 Dec 2025 15:56:10 -0800 Subject: [PATCH 4/7] refactor(nix): remove with keyword antipattern --- flake.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 74aea6f..bda4d30 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,7 @@ system: let pkgs = pkgsFor system; + inherit (pkgs) lib; # Update version when releasing version = "1.4.2"; @@ -40,10 +41,10 @@ "-X main.newtVersion=${version}" ]; - meta = with pkgs.lib; { + meta = { description = "A tunneling client for Pangolin"; homepage = "https://github.com/fosrl/newt"; - license = licenses.gpl3; + license = lib.licenses.gpl3; maintainers = [ ]; }; }; @@ -53,10 +54,20 @@ system: let pkgs = pkgsFor system; + + inherit (pkgs) + go + gopls + gotools + go-outline + gopkgs + godef + golint + ; in { default = pkgs.mkShell { - buildInputs = with pkgs; [ + buildInputs = [ go gopls gotools From f9fb13a0d7f35da7fe95423eed55548651a6c66d Mon Sep 17 00:00:00 2001 From: Varun Narravula Date: Wed, 3 Dec 2025 15:56:49 -0800 Subject: [PATCH 5/7] chore(nix): add water-sucks to maintainers list --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index bda4d30..b68a435 100644 --- a/flake.nix +++ b/flake.nix @@ -45,7 +45,9 @@ description = "A tunneling client for Pangolin"; homepage = "https://github.com/fosrl/newt"; license = lib.licenses.gpl3; - maintainers = [ ]; + maintainers = [ + lib.maintainers.water-sucks + ]; }; }; } From e27e6fbce86e47909c4c652b9c0ea021efefb4ca Mon Sep 17 00:00:00 2001 From: Varun Narravula Date: Wed, 3 Dec 2025 23:30:11 -0500 Subject: [PATCH 6/7] feat(nix): disable cgo for the newt package --- flake.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flake.nix b/flake.nix index b68a435..82638e8 100644 --- a/flake.nix +++ b/flake.nix @@ -37,6 +37,10 @@ vendorHash = "sha256-Jbu0pz+okV4N9MHUXLcTqSr3s/k5OVZ09hNuS/+4LFY="; + env = { + CGO_ENABLED = 0; + }; + ldflags = [ "-X main.newtVersion=${version}" ]; From 15b40b0f24006ab7e1e9fe4dd2b760a29d3a3923 Mon Sep 17 00:00:00 2001 From: Varun Narravula Date: Wed, 3 Dec 2025 23:32:23 -0500 Subject: [PATCH 7/7] chore(nix): sync to latest version number for newt package --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 82638e8..f92d486 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ inherit (pkgs) lib; # Update version when releasing - version = "1.4.2"; + version = "1.6.0"; in { default = self.packages.${system}.pangolin-newt;