Upgrade to go 1.18

This commit is contained in:
Kristoffer Dalby 2022-03-17 18:07:26 +00:00
parent 1e7d7e510e
commit 6d41279781
2 changed files with 30 additions and 8 deletions

View File

@ -17,16 +17,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1646254136, "lastModified": 1647536224,
"narHash": "sha256-8nQx02tTzgYO21BP/dy5BCRopE8OwE8Drsw98j+Qoaw=", "narHash": "sha256-SUIiz4DhMXgM7i+hvFWmLnhywr1WeRGIz+EIbwQQguM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3e072546ea98db00c2364b81491b893673267827", "rev": "dd8cebebbf0f9352501f251ac37b851d947f92dc",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-unstable", "ref": "master",
"type": "indirect" "type": "indirect"
} }
}, },

View File

@ -2,7 +2,10 @@
description = "headscale - Open Source Tailscale Control server"; description = "headscale - Open Source Tailscale Control server";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; # TODO: Use unstable when Go 1.18 has made it in
# https://nixpk.gs/pr-tracker.html?pr=164292
# nixpkgs.url = "nixpkgs/nixpkgs-unstable";
nixpkgs.url = "nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
@ -53,7 +56,7 @@
}; };
headscale = headscale =
pkgs.buildGo117Module rec { pkgs.buildGo118Module rec {
pname = "headscale"; pname = "headscale";
version = headscaleVersion; version = headscaleVersion;
src = pkgs.lib.cleanSource self; src = pkgs.lib.cleanSource self;
@ -72,7 +75,7 @@
overlays = [ self.overlay ]; overlays = [ self.overlay ];
inherit system; inherit system;
}; };
buildDeps = with pkgs; [ git go_1_17 gnumake ]; buildDeps = with pkgs; [ git go_1_18 gnumake ];
devDeps = with pkgs; devDeps = with pkgs;
buildDeps ++ [ buildDeps ++ [
golangci-lint golangci-lint
@ -110,8 +113,8 @@
packages = with pkgs; { packages = with pkgs; {
inherit headscale; inherit headscale;
inherit headscale-docker; inherit headscale-docker;
}; };
defaultPackage = pkgs.headscale; defaultPackage = pkgs.headscale;
# `nix run` # `nix run`
@ -120,6 +123,25 @@
}; };
defaultApp = apps.headscale; defaultApp = apps.headscale;
checks = {
format = pkgs.runCommand "check-format"
{
buildInputs = with pkgs; [
nixpkgs-fmt
golangci-lint
nodePackages.prettier
golines
clang-tools
];
} ''
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt ${./.}
${pkgs.golangci-lint}/bin/golangci-lint run --fix --timeout 10m
${pkgs.nodePackages.prettier}/bin/prettier --write '**/**.{ts,js,md,yaml,yml,sass,css,scss,html}'
${pkgs.golines}/bin/golines --max-len=88 --base-formatter=gofumpt -w ${./.}
${pkgs.clang-tools}/bin/clang-format -style="{BasedOnStyle: Google, IndentWidth: 4, AlignConsecutiveDeclarations: true, AlignConsecutiveAssignments: true, ColumnLimit: 0}" -i ${./.}
'';
};
}); });
} }