nix: update to Go 1.26 and fix deprecations

Update nixpkgs to master branch to get Go 1.26rc2. This is needed for
the new Go 1.26 features used in the codebase.

Changes:
- Use buildGo126Module and go_1_26 in build dependencies
- Update vendorHash for new dependencies
- Fix deprecated flake outputs: overlay→overlays.default,
  devShell→devShells.default, defaultPackage→packages.default
- Fix stdenv.isLinux→stdenv.hostPlatform.isLinux deprecation
This commit is contained in:
Kristoffer Dalby 2026-01-21 16:21:44 +00:00
parent b36438bf90
commit 35364bfc9a
2 changed files with 14 additions and 13 deletions

8
flake.lock generated
View file

@ -20,16 +20,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1766840161, "lastModified": 1769011238,
"narHash": "sha256-Ss/LHpJJsng8vz1Pe33RSGIWUOcqM1fjrehjUkdrWio=", "narHash": "sha256-WPiOcgZv7GQ/AVd9giOrlZjzXHwBNM4yQ+JzLrgI3Xk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3edc4a30ed3903fdf6f90c837f961fa6b49582d1", "rev": "a895ec2c048eba3bceab06d5dfee5026a6b1c875",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-unstable", "ref": "master",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View file

@ -2,7 +2,8 @@
description = "headscale - Open Source Tailscale Control server"; description = "headscale - Open Source Tailscale Control server";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # TODO: Move back to nixpkgs-unstable once Go 1.26 is available there
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
@ -23,11 +24,11 @@
default = headscale; default = headscale;
}; };
overlay = _: prev: overlays.default = _: prev:
let let
pkgs = nixpkgs.legacyPackages.${prev.system}; pkgs = nixpkgs.legacyPackages.${prev.system};
buildGo = pkgs.buildGo125Module; buildGo = pkgs.buildGo126Module;
vendorHash = "sha256-escboufgbk+lEitw48eWEIltXbaCPdysb/g4YR+extg="; vendorHash = "sha256-hL9vHunaxodGt3g/CIVirXy4OjZKTI3XwbVPPRb34OY=";
in in
{ {
headscale = buildGo { headscale = buildGo {
@ -129,10 +130,10 @@
(system: (system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
overlays = [ self.overlay ]; overlays = [ self.overlays.default ];
inherit system; inherit system;
}; };
buildDeps = with pkgs; [ git go_1_25 gnumake ]; buildDeps = with pkgs; [ git go_1_26 gnumake ];
devDeps = with pkgs; devDeps = with pkgs;
buildDeps buildDeps
++ [ ++ [
@ -167,7 +168,7 @@
clang-tools # clang-format clang-tools # clang-format
protobuf-language-server protobuf-language-server
] ]
++ lib.optional pkgs.stdenv.isLinux [ traceroute ]; ++ lib.optional pkgs.stdenv.hostPlatform.isLinux [ traceroute ];
# Add entry to build a docker image with headscale # Add entry to build a docker image with headscale
# caveat: only works on Linux # caveat: only works on Linux
@ -184,7 +185,7 @@
in in
rec { rec {
# `nix develop` # `nix develop`
devShell = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = buildInputs =
devDeps devDeps
++ [ ++ [
@ -219,8 +220,8 @@
packages = with pkgs; { packages = with pkgs; {
inherit headscale; inherit headscale;
inherit headscale-docker; inherit headscale-docker;
default = headscale;
}; };
defaultPackage = pkgs.headscale;
# `nix run` # `nix run`
apps.headscale = flake-utils.lib.mkApp { apps.headscale = flake-utils.lib.mkApp {