forked from zehome/MLVPN
-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
59 lines (55 loc) · 1.62 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
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
};
outputs = inp:
let
lib = inp.nixpkgs.lib;
systems = [ "aarch64-linux" "armv7l-linux" "x86_64-linux" ];
pkgsForSystem = system: inp.nixpkgs.legacyPackages."${system}";
pkgsCross = system: crossSystem: import inp.nixpkgs {
inherit system crossSystem;
};
buildFor = pkgs: pkgs.stdenv.mkDerivation {
src = ./.;
name = "mlvpn";
nativeBuildInputs = with pkgs; [
automake
autoconf
pkg-config
];
buildInputs = with pkgs; [
libev
libsodium
libpcap
];
preConfigure = ''
./autogen.sh
'';
};
in
rec {
defaultPackage = lib.genAttrs systems (system: packages."${system}".mlvpn);
packages = lib.genAttrs systems (system:
let
otherSystems = builtins.filter (s: s != system) systems;
in
{
mlvpn = buildFor (pkgsForSystem system);
mlvpn-static = buildFor (pkgsForSystem system).pkgsStatic;
}
# cross compiled packages
//
(lib.listToAttrs (map (crossSystem: lib.nameValuePair
"mlvpn-${crossSystem}"
(buildFor (pkgsCross system crossSystem))
) otherSystems ))
# cross compiled static packages
//
(lib.listToAttrs (map (crossSystem: lib.nameValuePair
"mlvpn-static-${crossSystem}"
(buildFor (pkgsCross system crossSystem).pkgsStatic)
) otherSystems ))
);
};
}