github.com/kelleygo/clashcore@v1.0.2/flake.nix (about)

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