This repository has been archived by the owner on Mar 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathflake.nix
75 lines (70 loc) · 2.01 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
{
description = "Socket lib for Lean";
inputs = {
lean = {
url = github:yatima-inc/lean4/acs/add-nix-ability-for-native-libs;
};
utils = {
url = github:yatima-inc/nix-utils;
};
nixpkgs.url = github:nixos/nixpkgs/nixos-21.05;
flake-utils = {
url = github:numtide/flake-utils;
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, lean, flake-utils, nixpkgs, utils }:
let
supportedSystems = [
# "aarch64-linux"
# "aarch64-darwin"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
in
flake-utils.lib.eachSystem supportedSystems (system:
let
leanPkgs = lean.packages.${system};
pkgs = import nixpkgs { inherit system; };
name = "lean-socket";
inherit (utils.lib.${system}) buildCLib forEachRowJoin;
native = buildCLib {
src = ./native;
name = "lean-socket-native";
updateCCOptions = o: o ++ [ "-I${leanPkgs.lean-bin-tools-unwrapped}/include" ];
extraDrvArgs = { linkName = "lean-socket-native"; };
};
project = leanPkgs.buildLeanPackage {
name = "Socket";
src = ./.;
nativeSharedLibs = [ native.sharedLib ];
};
examples = import ./examples/default.nix {
inherit pkgs native;
lean = leanPkgs;
Socket = project;
};
in
{
inherit project;
packages = {
inherit native;
inherit (project) modRoot sharedLib staticLib;
inherit examples;
};
checks =
let
exampleExecutables = forEachRowJoin (name: p: { ${name} = p.executable; }) examples;
in
{
inherit exampleExecutables;
};
defaultPackage = project.modRoot;
devShell = pkgs.mkShell {
buildInputs = [ leanPkgs.lean ];
LEAN_PATH = "${leanPkgs.Lean.modRoot}";
CPATH = "${leanPkgs.Lean.modRoot}";
};
});
}