forked from mit-plv/koika
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure nix tool chain and use makes for CI
Makes provides several interesting tools for our context: - attestation of the build products (i.e. for the verified Kôika compiler) - linters and formatters - container image generators and other deployment / packaging tools
- Loading branch information
1 parent
22bfd42
commit a29f059
Showing
7 changed files
with
164 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
lib, | ||
mkCoqDerivation, | ||
coq, | ||
boost, | ||
python3, | ||
sphinx, | ||
doCheck ? false, | ||
}: | ||
mkCoqDerivation rec { | ||
pname = "koika"; | ||
defaultVersion = "0.0.1"; | ||
|
||
opam-name = "koika"; | ||
useDune = true; | ||
|
||
release."0.0.1" = { | ||
src = lib.const (lib.cleanSourceWith { | ||
src = lib.cleanSource ./.; | ||
filter = let | ||
inherit (lib) all hasSuffix; | ||
ignorePaths = xs: path: all (x: ! hasSuffix x path) xs; | ||
in | ||
path: _: ignorePaths (import ./ignored_paths.nix) path; | ||
}); | ||
}; | ||
|
||
enableParallelBuilding = true; | ||
|
||
nativeBuildInputs = [ | ||
python3 | ||
sphinx | ||
]; | ||
|
||
buildInputs = [ | ||
boost | ||
]; | ||
|
||
propagatedBuildInputs = with coq.ocamlPackages; [ | ||
findlib | ||
base | ||
core | ||
core_unix | ||
stdio | ||
parsexp | ||
hashcons | ||
zarith | ||
]; | ||
|
||
preInstall = '' | ||
dune build README.html | ||
mkdir -p $out/share/doc/koika | ||
cp README.html $out/share/doc/koika/ | ||
''; | ||
|
||
postInstall = '' | ||
mkdir -p "$OCAMLFIND_DESTDIR" | ||
mv "$out/lib/koika" "$OCAMLFIND_DESTDIR" | ||
''; | ||
|
||
inherit doCheck; | ||
checkPhase = '' | ||
runHook preCheck | ||
./coq.kernel.hack.sh | ||
dune build @runtest | ||
runHook postCheck | ||
''; | ||
|
||
shellHook = '' | ||
[ -x coq.kernel.hack.sh ] && ./coq.kernel.hack.sh | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ | ||
"default.nix" | ||
"flake.nix" | ||
"makes.lock.nix" | ||
"makes.nix" | ||
"overlay.nix" | ||
"makes" | ||
".gitignore" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
makesSrc = builtins.fetchGit { | ||
url = "https://github.com/fluidattacks/makes"; | ||
ref = "refs/tags/24.02"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
fetchNixpkgs, | ||
inputs, | ||
makeSearchPaths, | ||
... | ||
}: { | ||
cache.readNixos = true; | ||
formatNix = { | ||
enable = true; | ||
targets = ["/"]; | ||
}; | ||
inputs = { | ||
# Use nixpkgs from recorded flake.lock | ||
nixpkgs = let | ||
nixpkgsAttrs = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; | ||
in | ||
fetchNixpkgs { | ||
rev = nixpkgsAttrs.rev; | ||
sha256 = nixpkgsAttrs.narHash; | ||
acceptAndroidSdkLicense = false; | ||
allowUnfree = false; | ||
overlays = [(import ./overlay.nix)]; | ||
}; | ||
}; | ||
outputs."/build" = makeSearchPaths { | ||
bin = [ | ||
(inputs.nixpkgs.coqPackages_8_14.koika.override { | ||
doCheck = true; | ||
}) | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
final: prev: let | ||
koikaPkg = ./default.nix; | ||
injectKoika = name: set: | ||
prev.${name}.overrideScope (self: _: { | ||
koika = self.callPackage koikaPkg {}; | ||
}); | ||
in | ||
(prev.lib.mapAttrs injectKoika { | ||
inherit (final) coqPackages_8_14; | ||
}) | ||
// { | ||
coqPackages_koika = prev.coqPackages_8_14.overrideScope (self: super: { | ||
coq = super.coq.override {customOCamlPackages = prev.ocaml-ng.ocamlPackages_4_09;}; | ||
koika = self.callPackage koikaPkg {}; | ||
}); | ||
} |