-
Notifications
You must be signed in to change notification settings - Fork 21
/
project.ncl
108 lines (98 loc) · 3.22 KB
/
project.ncl
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
let inputs = import "./nickel.lock.ncl" in
let organist = inputs.organist in
let import_nix = organist.nix.import_nix in
organist.OrganistExpression
& {
Schema,
config | Schema
= {
shells =
organist.shells.Bash
& {
build.packages = {
nickel = import_nix "nixpkgs#nickel",
parallel = import_nix "nixpkgs#parallel",
gnused = import_nix "nixpkgs#gnused",
},
},
flake.apps.run-test =
let testScript | organist.nix.builders.ShellApplication
= {
name = "run-test.sh",
content.file = organist.nix.builtins.import_file "run-test.sh",
runtime_inputs = {
nickel = import_nix "nixpkgs#nickel",
parallel = import_nix "nixpkgs#parallel",
gnused = import_nix "nixpkgs#gnused",
},
}
in
{
type = "app",
program | organist.nix.nix_string.NixString = nix-s%"%{testScript}/bin/run-test.sh"%
},
flake.packages = {
# Re-exported to make it easy for downstream to depend on them
nickel = import_nix "nixpkgs#nickel",
nls = import_nix "nixpkgs#nls",
},
flake.checks
| { _ | organist.nix.builders.NixpkgsPkg }
= {
alejandra = {
name = "check-alejandra",
version = "0.0",
env.buildCommand = nix-s%"
%{import_nix "nixpkgs#alejandra"}/bin/alejandra --check %{import_nix "self"}
touch $out
"%,
},
nickel-format = {
name = "check-nickel-format",
version = "0.0",
env.buildInputs.nickel = import_nix "nixpkgs#nickel",
env.buildCommand = nix-s%"
cd %{import_nix "self"}
failed=""
for f in $(find . -name future -prune -or -name '*.ncl' -print); do
if ! diff -u "$f" <(nickel format < "$f"); then
failed="$failed $f"
fi
done
if [ "$failed" != "" ]; then
echo "Following files need to be formatted: $failed"
exit 1
fi
touch $out
"%,
},
lsp = {
name = "organist-lsp-integration",
version = "0.0",
env.buildInputs = {
nls = import_nix "nixpkgs#nls",
python3 = import_nix "nixpkgs#python3",
pygls = import_nix "nixpkgs#python3Packages.pygls",
pytest = import_nix "nixpkgs#python3Packages.pytest",
pytest-asyncio = import_nix "nixpkgs#python3Packages.pytest-asyncio",
},
env = {
src = import_nix "self",
phases = ["unpackPhase", "testPhase", "installPhase"],
testPhase = nix-s%"
cd tests/lsp
pytest | tee $out
"%,
installPhase = "touch $out",
},
},
},
flake.checks = import "tests/main.ncl",
files.".gitignore".materialisation_method = 'Copy,
files.".gitignore".content = m%"
# This file is generated by Organist, please don't edit directly
/examples/*/result
/result
"%,
},
} | organist.modules.T