mirror of
https://github.com/juanfont/headscale.git
synced 2026-09-10 02:31:59 +09:00
flake: track latest Go in nixpkgs
Use buildGoLatestModule and go_latest so a Go release bump is a flake.lock update, not a flake.nix edit. Drop the vendored golangci-lint derivation, now current in nixpkgs.
This commit is contained in:
committed by
Kristoffer Dalby
parent
5e804240ed
commit
07b5344145
Generated
+4
-4
@@ -60,16 +60,16 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1784421286,
|
||||
"narHash": "sha256-YKn3t7FvaargtyNHbrOw+qzDM+93q5kSCREUPNxeZQs=",
|
||||
"lastModified": 1787394516,
|
||||
"narHash": "sha256-pRGOQSClnXNI2iLUG6DYpsGvYcuw0drOutVZFTJNw90=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "62eaae30cd05c04718500ddb44e7ef85cd45ddd5",
|
||||
"rev": "c8f90650c15282fa8656a041bfbbd2403997a9a7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "staging-next-26.05",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
description = "headscale - Open Source Tailscale Control server";
|
||||
|
||||
inputs = {
|
||||
# Pinned to staging-next-26.05 for Go 1.26.5: the Tailscale HEAD build
|
||||
# (Dockerfile.tailscale-HEAD) requires go >= 1.26.5, and nixpkgs-unstable
|
||||
# still ships 1.26.4 — the bump is merged to nixpkgs staging but the
|
||||
# large-rebuild staging->unstable pipeline lags. The 26.05 line is otherwise
|
||||
# current (dev tools match unstable). Switch back to nixpkgs-unstable once it
|
||||
# ships go_1_26 >= 1.26.5.
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/staging-next-26.05";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
# Reusable Go flake checks (build/test/lint/format); CI runs them via
|
||||
# `nix build .#checks.<system>.<name>` instead of bespoke per-tool steps.
|
||||
@@ -37,8 +31,9 @@
|
||||
overlays.default = _: prev:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${prev.stdenv.hostPlatform.system};
|
||||
# Go 1.26 builder; resolves to Go 1.26.5 from the pinned nixpkgs.
|
||||
buildGo = pkgs.buildGo126Module;
|
||||
# Tracks the newest Go in nixpkgs (currently 1.27) so a Go release
|
||||
# bump is a flake.lock update, not a flake.nix edit.
|
||||
buildGo = pkgs.buildGoLatestModule;
|
||||
vendorHash = (builtins.fromJSON (builtins.readFile ./flakehashes.json)).vendor.sri;
|
||||
in
|
||||
{
|
||||
@@ -72,48 +67,6 @@
|
||||
subPackages = [ "cmd/hi" ];
|
||||
};
|
||||
|
||||
# Build golangci-lint with stock Go 1.26 (upstream uses hardcoded Go
|
||||
# version); it does not build against the pinned 1.26.5.
|
||||
golangci-lint = buildGo rec {
|
||||
pname = "golangci-lint";
|
||||
version = "2.12.2";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "golangci";
|
||||
repo = "golangci-lint";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-qR7fp1x2S+EwEAcplRHTvA3jWwLr/XSiYKSZtAwkrNU=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-AG5wtLwWLz55bdp1oi3cW+9O3yj1W1P7MV9zxym7Pb4=";
|
||||
|
||||
subPackages = [ "cmd/golangci-lint" ];
|
||||
|
||||
nativeBuildInputs = [ pkgs.installShellFiles ];
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.version=${version}"
|
||||
"-X main.commit=v${version}"
|
||||
"-X main.date=1970-01-01T00:00:00Z"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
for shell in bash zsh fish; do
|
||||
HOME=$TMPDIR $out/bin/golangci-lint completion $shell > golangci-lint.$shell
|
||||
installShellCompletion golangci-lint.$shell
|
||||
done
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Fast linters runner for Go";
|
||||
homepage = "https://golangci-lint.run/";
|
||||
changelog = "https://github.com/golangci/golangci-lint/blob/v${version}/CHANGELOG.md";
|
||||
mainProgram = "golangci-lint";
|
||||
};
|
||||
};
|
||||
|
||||
gotestsum = prev.gotestsum.override {
|
||||
buildGoModule = buildGo;
|
||||
};
|
||||
@@ -126,8 +79,8 @@
|
||||
buildGoModule = buildGo;
|
||||
};
|
||||
|
||||
gopls = prev.gopls.override {
|
||||
buildGoLatestModule = buildGo;
|
||||
golines = prev.golines.override {
|
||||
buildGoModule = buildGo;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -138,7 +91,7 @@
|
||||
overlays = [ self.overlays.default ];
|
||||
inherit system;
|
||||
};
|
||||
buildDeps = with pkgs; [ git go_1_26 gnumake ];
|
||||
buildDeps = with pkgs; [ git go_latest gnumake ];
|
||||
devDeps = with pkgs;
|
||||
buildDeps
|
||||
++ [
|
||||
@@ -163,10 +116,10 @@
|
||||
# roundtrip tests (TestAPIv2). Binaries: tofu, tscli.
|
||||
opentofu
|
||||
tscli
|
||||
python314Packages.mdformat
|
||||
python314Packages.mdformat-footnote
|
||||
python314Packages.mdformat-frontmatter
|
||||
python314Packages.mdformat-mkdocs
|
||||
python3Packages.mdformat
|
||||
python3Packages.mdformat-footnote
|
||||
python3Packages.mdformat-frontmatter
|
||||
python3Packages.mdformat-mkdocs
|
||||
prek
|
||||
|
||||
# 'dot' is needed for pprof graphs
|
||||
@@ -199,7 +152,7 @@
|
||||
pname = "headscale";
|
||||
version = headscaleVersion;
|
||||
vendorHash = (builtins.fromJSON (builtins.readFile ./flakehashes.json)).vendor.sri;
|
||||
goPkg = pkgs.go_1_26;
|
||||
goPkg = pkgs.go_latest;
|
||||
# //go:embed targets and test-read files outside the default whitelist.
|
||||
embedDirs = [ ./hscontrol/assets ./hscontrol/db/schema.sql ./config-example.yaml ];
|
||||
extraSrc = [
|
||||
|
||||
Reference in New Issue
Block a user