clash/flake.nix

62 lines
1.4 KiB
Nix
Raw Normal View History

{
2023-11-03 13:01:45 +00:00
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 {
2023-11-03 13:01:45 +00:00
packages.default = pkgs.mihomo-meta;
}
) //
(
let version = nixpkgs.lib.substring 0 8 self.lastModifiedDate or self.lastModified or "19700101"; in
{
overlay = final: prev: {
2023-11-03 13:01:45 +00:00
mihomo-meta = final.buildGo119Module {
pname = "mihomo-meta";
inherit version;
src = ./.;
2023-03-18 11:55:29 +00:00
vendorSha256 = "sha256-W5oiPtTRin0731QQWr98xZ2Vpk97HYcBtKoi1OKZz+w=";
# Do not build testing suit
excludedPackages = [ "./test" ];
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
2023-11-03 13:01:45 +00:00
"-X github.com/metacubex/mihomo/constant.Version=dev-${version}"
"-X github.com/metacubex/mihomo/constant.BuildTime=${version}"
];
2022-10-08 07:40:41 +00:00
tags = [
"with_gvisor"
];
# Network required
doCheck = false;
postInstall = ''
2023-11-03 13:01:45 +00:00
mv $out/bin/mihomo $out/bin/mihomo-meta
'';
};
};
}
);
}