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..f92d486 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 = @@ -22,30 +22,36 @@ system: let pkgs = pkgsFor system; + inherit (pkgs) lib; # 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 - ''; + version = "1.6.0"; in { default = self.packages.${system}.pangolin-newt; + pangolin-newt = pkgs.buildGoModule { pname = "pangolin-newt"; - version = version; - src = srcWithReplacedVersion; - vendorHash = "sha256-PENsCO2yFxLVZNPgx2OP+gWVNfjJAfXkwWS7tzlm490="; - meta = with pkgs.lib; { + inherit version; + src = pkgs.nix-gitignore.gitignoreSource [ ] ./.; + + vendorHash = "sha256-Jbu0pz+okV4N9MHUXLcTqSr3s/k5OVZ09hNuS/+4LFY="; + + env = { + CGO_ENABLED = 0; + }; + + ldflags = [ + "-X main.newtVersion=${version}" + ]; + + meta = { description = "A tunneling client for Pangolin"; homepage = "https://github.com/fosrl/newt"; - license = licenses.gpl3; - maintainers = [ ]; + license = lib.licenses.gpl3; + maintainers = [ + lib.maintainers.water-sucks + ]; }; }; } @@ -54,10 +60,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