forked from MetaCubeX/mihomo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
61 lines (48 loc) · 1.43 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
description = "Another Mihomo Kernel";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/master";
inputs.utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
in
rec {
packages.default = pkgs.mihomo-meta;
}
) //
(
let version = nixpkgs.lib.substring 0 8 self.lastModifiedDate or self.lastModified or "19700101"; in
{
overlay = final: prev: {
mihomo-meta = final.buildGo119Module {
pname = "mihomo-meta";
inherit version;
src = ./.;
vendorSha256 = "sha256-W5oiPtTRin0731QQWr98xZ2Vpk97HYcBtKoi1OKZz+w=";
# Do not build testing suit
excludedPackages = [ "./test" ];
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X github.com/metacubex/mihomo/constant.Version=dev-${version}"
"-X github.com/metacubex/mihomo/constant.BuildTime=${version}"
];
tags = [
"with_gvisor"
];
# Network required
doCheck = false;
postInstall = ''
mv $out/bin/mihomo $out/bin/mihomo-meta
'';
};
};
}
);
}