-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathchecks.nix
More file actions
157 lines (150 loc) · 4.35 KB
/
Copy pathchecks.nix
File metadata and controls
157 lines (150 loc) · 4.35 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
pkgs,
version,
}:
{
github-actions = pkgs.stdenv.mkDerivation {
pname = "scip-github-actions";
inherit version;
src = ./.;
nativeBuildInputs = [
pkgs.action-validator
pkgs.git
];
buildPhase = ''
# action-validator >=0.7 calls `git ls-files` to discover workflows;
# initialise a throwaway repo so it works inside the Nix sandbox.
git init -q
git add -A
for f in .github/workflows/*.yml .github/workflows/*.yaml; do
[ -e "$f" ] && action-validator -v "$f"
done
'';
installPhase = "touch $out";
};
formatting = pkgs.stdenv.mkDerivation {
pname = "scip-formatting";
inherit version;
src = ./.;
nativeBuildInputs = with pkgs; [
buf
go
gotools
nixfmt
prettier
];
buildPhase = ''
prettier --check '**/*.{ts,js(on)?,md,yml}'
BUF_CACHE_DIR=$(mktemp -d) buf format --diff --exit-code scip.proto
gofmt -d . | tee /dev/stderr | diff /dev/null -
goimports -d . | tee /dev/stderr | diff /dev/null -
nixfmt --check *.nix
'';
installPhase = "touch $out";
};
go-bindings = pkgs.buildGoModule {
pname = "scip-bindings-go";
inherit version;
src = ./.;
modRoot = "./bindings/go/scip";
vendorHash = "sha256-7R+qrgZCcoJ9oy5VhLsdskC/oyJRrqkcrI0JOiMAR0w=";
env.GOWORK = "off";
buildTags = [ "asserts" ];
subPackages = [
"."
"memtest"
"testutil"
];
installPhase = "touch $out";
};
haskell-bindings =
let
cabal = pkgs.haskellPackages.callCabal2nix "scip" ./bindings/haskell { };
in
assert pkgs.lib.assertMsg (
cabal.version == version
) "Version mismatch in bindings/haskell/scip.cabal: expected ${version}, got ${cabal.version}";
cabal.overrideAttrs (oldAttrs: {
prePatch = ''
cp --remove-destination ${./LICENSE} LICENSE
'';
postPatch = (oldAttrs.postPatch or "") + ''
${pkgs.haskellPackages.cabal-install}/bin/cabal check
'';
});
reprolang =
let
reprolangVersion = (builtins.fromJSON (builtins.readFile ./reprolang/package.json)).version;
in
assert pkgs.lib.assertMsg (
reprolangVersion == version
) "Version mismatch in reprolang/package.json: expected ${version}, got ${reprolangVersion}";
pkgs.buildGoModule {
pname = "scip-reprolang";
inherit version;
src = ./.;
modRoot = "./reprolang";
vendorHash = "sha256-RnXZMTHrIr02jA4GI1kX4D94GiHu7XbLLCk1RBtPVQc=";
proxyVendor = true;
env.GOWORK = "off";
buildInputs = [ pkgs.tree-sitter ];
subPackages = [
"grammar"
"repro"
];
installPhase = "touch $out";
};
reprolang-generated = pkgs.stdenv.mkDerivation {
pname = "scip-reprolang-generated";
inherit version;
src = ./.;
nativeBuildInputs = with pkgs; [
nodejs
prettier
tree-sitter
];
buildPhase = ''
cd reprolang
cp -r grammar grammar-before
tree-sitter generate --abi 14 --output grammar
prettier --write 'grammar/grammar.json' 'grammar/node-types.json'
diff -rq grammar-before grammar
'';
installPhase = "touch $out";
};
rust-bindings =
let
cargoTomlVersion =
(builtins.fromTOML (builtins.readFile ./bindings/rust/Cargo.toml)).package.version;
in
assert pkgs.lib.assertMsg (
cargoTomlVersion == version
) "Version mismatch in bindings/rust/Cargo.toml: expected ${version}, got ${cargoTomlVersion}";
pkgs.rustPlatform.buildRustPackage {
pname = "scip-bindings-rust";
inherit version;
src = ./bindings/rust;
cargoLock = {
lockFile = ./bindings/rust/Cargo.lock;
};
};
typescript-bindings =
let
packageJsonVersion =
(builtins.fromJSON (builtins.readFile ./bindings/typescript/package.json)).version;
in
assert pkgs.lib.assertMsg (packageJsonVersion == version)
"Version mismatch in bindings/typescript/package.json: expected ${version}, got ${packageJsonVersion}";
pkgs.buildNpmPackage {
pname = "scip-bindings-typescript";
inherit version;
src = ./bindings/typescript;
npmDepsHash = "sha256-WottCsOUbrrR2zH8WzmUCR88e0wz3ygbujWXsuKshJs=";
buildPhase = ''
runHook preBuild
npm run build
runHook postBuild
'';
installPhase = "touch $out";
};
}