forked from tomhanika/conexp-clj
-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
119 lines (101 loc) · 3.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{
description = "conexp-clj, a general purpose software tool for Formal Concept Analysis";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
clj-nix = {
url = "github:jlesquembre/clj-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
utils,
...
} @ inputs: let
inherit (utils.lib) mkApp mkFlake;
in
mkFlake {
inherit self inputs;
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
channels.nixpkgs.overlaysBuilder = channels: [inputs.clj-nix.overlays.default];
overlays.default = final: prev: {
inherit (self.packages."${final.system}") conexp-clj;
};
outputsBuilder = channels: let
inherit (inputs.gitignore.lib) gitignoreSource;
inherit (inputs.clj-nix.lib) mk-deps-cache;
inherit (channels.nixpkgs) mkCljBin mkShell writeShellScriptBin;
inherit (channels.nixpkgs.lib) pipe;
conexp = let
versionFromDefproject = name:
pipe ./project.clj [
builtins.readFile
(builtins.match ''
.*\([[:SPACE:]]*defproject[[:SPACE:]]+${name}[[:SPACE:]]+"([^"]+)".*'')
builtins.head
];
pname = "conexp-clj";
in
mkCljBin rec {
name = "conexp/${pname}";
version = versionFromDefproject pname;
meta = {
description = "A General-Purpose Tool for Formal Concept Analysis";
homepage = "https://github.com/tomhanika/conexp-clj";
license = channels.nixpkgs.lib.licenses.epl10;
};
projectSrc = gitignoreSource ./.;
main-ns = "conexp";
buildCommand = ''
lein uberjar
mkdir -p target
cp builds/uberjar/${pname}-${version}-standalone.jar target
'';
doCheck = true;
checkPhase = "lein test";
};
in rec {
packages = {
conexp-clj = conexp;
default = conexp;
};
apps = rec {
deps-lock = mkApp {
drv = writeShellScriptBin "deps-lock" ''
${channels.nixpkgs.deps-lock}/bin/deps-lock --lein $@
'';
};
test = let
deps = mk-deps-cache {lock-file = ./deps-lock.json;};
in
mkApp {
drv = writeShellScriptBin "conexp-clj-tests" ''
lein test $@
'';
};
};
checks = {
inherit (packages) conexp-clj;
devShell = devShells.default;
};
devShells.default = mkShell {
buildInputs = with channels.nixpkgs; [clojure-lsp leiningen];
};
formatter = channels.nixpkgs.alejandra;
};
};
}
# Local Variables:
# apheleia-formatter: alejandra
# End: