-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
85 lines (76 loc) · 2.09 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
74
75
76
77
78
79
80
81
82
83
84
85
rec {
description = "Hysteria is a powerful, lightning fast and censorship resistant proxy.";
nixConfig = {
extra-substituters = [ "https://hysteria.cachix.org" ];
extra-trusted-public-keys = [
"hysteria.cachix.org-1:zAG2qV/akrj0TPOf28gxWTDj57f8SuYjqjHw2u38vZI="
];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
options-nix.url = "github:eum3l/options.nix";
src = {
type = "github";
owner = "apernet";
repo = "hysteria";
ref = "app/v2.6.0";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
src,
options-nix,
}:
let
platforms = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
in
flake-utils.lib.eachSystem platforms (
system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnsupportedSystem = true;
};
in
rec {
formatter = pkgs.nixfmt-rfc-style;
packages = rec {
default = hysteria;
hysteria = pkgs.callPackage ./package.nix {
inherit platforms src;
inherit (self.inputs.src) lastModifiedDate rev;
version = pkgs.lib.removePrefix "app/v" inputs.src.ref;
};
options = options-nix.lib.mkOptionScript {
inherit system;
module = self.nixosModules.default;
modulePrefix = "services.hysteria";
};
};
checks.default = pkgs.callPackage ./check { hysteria = self.nixosModules.default; };
devShells.default = pkgs.mkShellNoCC {
HYSTERIA_LOG_LEVEL = "debug";
HYSTERIA_TMP = "/tmp/hysteria";
inputsFrom = [ packages.hysteria ];
shellHook = ''
rm -r $HYSTERIA_TMP
cp -r --no-preserve=mode,ownership ${src} $HYSTERIA_TMP
cd $HYSTERIA_TMP
'';
};
}
)
// {
nixosModules.default = import ./module.nix self.packages;
};
}