-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathflake.nix
73 lines (60 loc) · 1.95 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
61
62
63
64
65
66
67
68
69
70
71
72
73
{
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk.url = "github:nix-community/naersk";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/nixos-unstable";
};
outputs = { self, fenix, flake-utils, nixpkgs, naersk }:
flake-utils.lib.eachSystem
(with flake-utils.lib.system;
[ x86_64-linux aarch64-linux ])
(system:
let
pkgs = import nixpkgs { inherit system; };
version = pkgs.lib.substring 0 8 self.lastModifiedDate
or self.lastModified or "19700101";
toolchain = with fenix.packages.${system}; combine [
minimal.cargo
minimal.rustc
];
fenix-naersk = naersk.lib.${system}.override {
cargo = toolchain;
rustc = toolchain;
};
in
rec {
packages.default =
fenix-naersk.buildPackage
{
name = "clash2sing-box";
src = self;
inherit version;
cargoBuildFlags = "-p ctos";
# cargoLock = {
# lockFile = ./Cargo.lock;
# outputHashes = {
# "yew-0.20.0" = "sha256-x1Z85JMpeJqz1R8D4dbMLol06ZN0bVyIuA057H6Ce38=";
# };
# };
mainProgram = "ctos-${system}";
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl ];
doCheck = false;
postInstall = ''
mv $out/bin/ctos $out/bin/ctos-${system}
'';
};
devShells.default = pkgs.mkShell {
inputsFrom = [ packages.default ];
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/ctos-${system}";
};
})
;
}