Tailscale stuck on v1.8.6

I’m running Tailscale on NixOS 21.05, using this tailscale configuration, and everything works fine.

However, Tailscale is stuck on version 1.8.6, even though it appears to be up-to-date (v1.14.0) in nixpkgs.

I’ve run nixos-rebuild switch and rebooted multipled times, but no change. Anyone know why my version isn’t being updated?

~ (*) > tailscale --version
1.8.6
  go version: go1.16.5

~ (*) > tailscaled --version   
1.8.6
  go version: go1.16.5

~ (*) > cat ~/dev/nixpkgs/pkgs/servers/tailscale/default.nix
{ lib, buildGoModule, fetchFromGitHub, makeWrapper, iptables, iproute2, procps }:

buildGoModule rec {
  pname = "tailscale";
  version = "1.14.0";

  src = fetchFromGitHub {
    owner = "tailscale";
    repo = "tailscale";
    rev = "v${version}";
    sha256 = "sha256-FlPb7PtX/q34I7DZBLB9RIlg9tjKqktwn7N8Pv02hYc=";
  };

  nativeBuildInputs = [ makeWrapper ];

  CGO_ENABLED = 0;

  vendorSha256 = "sha256-em6443czDMak9RxLq7Dj9miknqg29vf0a0N82LmNrHk=";

  doCheck = false;

  subPackages = [ "cmd/tailscale" "cmd/tailscaled" ];

  tags = [ "xversion" ];

  ldflags = [ "-X tailscale.com/version.Long=${version}" "-X tailscale.com/version.Short=${version}" ];

  postInstall = ''
    wrapProgram $out/bin/tailscaled --prefix PATH : ${lib.makeBinPath [ iproute2 iptables ]}
    wrapProgram $out/bin/tailscale --suffix PATH : ${lib.makeBinPath [ procps ]}

    sed -i -e "s#/usr/sbin#$out/bin#" -e "/^EnvironmentFile/d" ./cmd/tailscaled/tailscaled.service
    install -D -m0444 -t $out/lib/systemd/system ./cmd/tailscaled/tailscaled.service
  '';

  meta = with lib; {
    homepage = "https://tailscale.com";
    description = "The node agent for Tailscale, a mesh VPN built on WireGuard";
    platforms = platforms.linux;
    license = licenses.bsd3;
    maintainers = with maintainers; [ danderson mbaillie ];
  };
}
################################################################################
# Tailscale Config (in configuration.nix)
################################################################################

  # Tailscale config, based on:
  # https://tailscale.com/blog/nixos-minecraft/
  services.tailscale.enable = true;
  
  # create a systemd oneshot job to authenticate with Tailscale.com at login
  systemd.services.tailscale-autoconnect = {
    description = "Automatic connection to Tailscale.com";

    # make sure tailscale is running locally before trying to connect to Tailscale.com
    after = [ "network-pre.target" "tailscale.service" ];
    wants = [ "network-pre.target" "tailscale.service" ];
    wantedBy = [ "multi-user.target" ];

    # set this service as a oneshot job
    serviceConfig.Type = "oneshot";

    # have the job run this shell script to authenticate with Tailscale.com
    script = with pkgs; ''
      # wait for tailscaled to settle
      # (as of tailscale 1.4 this should no longer be necessary, but I find it still is)
      echo "Waiting for tailscale service start completion ..." 
      sleep 5

      # check if we are already authenticated with Tailscale.com
      echo "Checking if already authenticated with Tailscale.com ..."
      status="$(${tailscale}/bin/tailscale status -json | ${jq}/bin/jq -r .BackendState)"
      if [ $status = "Running" ]; then  # do nothing
      	echo "Already authenticated with Tailscale.com, exiting."
        exit 0
      fi
        
      # otherwise authenticate with tailscale
      echo "Authenticating with Tailscale ..."
      ${tailscale}/bin/tailscale up --authkey $(cat /etc/tailscale/tskey-reusable)
    '';
  };

Unstable is indeed at the latest version, however, stable (21.05) is at 1.8.6. The latest tailscale has not been backported.

3 Likes

Ah, thank you! Didn’t realize the nixpkgs I was looking at was for unstable.

Is it possible to create an overlay that builds 1.14.0 in NixOS 21.05? I’m still new to NixOS, learning overlays is on my todo list, but haven’t gotten to that yet.

This article in the wiki should provide a few pointers

2 Likes