Skip to content

Commit 4151464

Browse files
authored
chore: use new nixpkgs with overlay which bring back go_1_20 instead of using old nixpkgs (FloatTech#1162)
1 parent 0b89312 commit 4151464

File tree

4 files changed

+41
-14
lines changed

4 files changed

+41
-14
lines changed

default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
}
1212
),
1313
buildGoApplication ? pkgs.buildGoApplication,
14+
...
1415
}:
1516
buildGoApplication {
1617
pname = "ZeroBot-Plugin";

flake.lock

Lines changed: 21 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
description = "基于 ZeroBot 的 OneBot 插件";
33

4-
# pin nixpkgs to preserve dropped go_1_20
5-
inputs.nixpkgs.url = "github:NixOS/nixpkgs/33c51330782cb486764eb598d5907b43dc87b4c2";
4+
inputs.nixpkgs-with-go_1_20.url = "github:NixOS/nixpkgs/33c51330782cb486764eb598d5907b43dc87b4c2";
5+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
66
inputs.flake-utils.url = "github:numtide/flake-utils";
77
inputs.gomod2nix.url = "github:nix-community/gomod2nix";
88
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
@@ -11,26 +11,36 @@
1111
outputs = {
1212
self,
1313
nixpkgs,
14+
nixpkgs-with-go_1_20,
1415
flake-utils,
1516
gomod2nix,
16-
}: let
17+
...
18+
} @ inputs: let
1719
allSystems = flake-utils.lib.allSystems;
1820
in (
1921
flake-utils.lib.eachSystem allSystems
2022
(system: let
21-
pkgs = nixpkgs.legacyPackages.${system};
23+
old-nixpkgs = nixpkgs-with-go_1_20.legacyPackages.${system};
24+
pkgs = import nixpkgs {
25+
inherit system;
26+
27+
overlays = [
28+
(_: _: {
29+
go_1_20 = old-nixpkgs.go_1_20;
30+
})
31+
];
32+
};
2233

2334
# The current default sdk for macOS fails to compile go projects, so we use a newer one for now.
2435
# This has no effect on other platforms.
2536
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
2637
in {
2738
# doCheck will fail at write files
2839
packages = rec {
29-
30-
ZeroBot-Plugin =
31-
(callPackage ./. {
40+
ZeroBot-Plugin = (callPackage ./. (inputs
41+
// {
3242
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
33-
})
43+
}))
3444
.overrideAttrs (_: {doCheck = false;});
3545

3646
default = ZeroBot-Plugin;
@@ -43,7 +53,6 @@
4353
pkgs.cacert
4454
];
4555
};
46-
4756
};
4857
devShells.default = callPackage ./shell.nix {
4958
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;

shell.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
mkGoEnv ? pkgs.mkGoEnv,
1414
gomod2nix ? pkgs.gomod2nix,
1515
}: let
16-
goEnv = mkGoEnv {pwd = ./.;};
16+
goEnv = mkGoEnv { pwd = ./.; go = pkgs.go_1_20; };
1717
in
1818
pkgs.mkShell {
1919
packages = [

0 commit comments

Comments
 (0)