Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates and improvements #24

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Nix flake
spacefrogg committed Sep 13, 2024

Verified

This commit was signed with the committer’s verified signature.
evenyag Yingwen
commit f14b74c6ed3ddca4314d56dc4e549ba0f38b3ec5
67 changes: 67 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
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/doc/koika
cp README.html $out/doc/koika/
'';

inherit doCheck;
checkPhase = ''
runHook preCheck
./coq.kernel.hack.sh
dune build --always-show-command-line --no-config --profile release @runtest
runHook postCheck
'';

shellHook = ''
[ -x coq.kernel.hack.sh ] && ./coq.kernel.hack.sh
'';
}
96 changes: 96 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
description = "A core language for rule-based hardware design";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
makes.url = "github:fluidattacks/makes/24.02";
nixpkgs.url = "github:nixos/nixpkgs/release-24.05";
};

outputs = {
self,
flake-utils,
makes,
nixpkgs,
...
}:
with flake-utils.lib;
eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
checks = {
koika = self.packages.${system}.default.override {
doCheck = true;
};
};

devShells.default = self.checks.${system}.koika;

packages = {
default = self.packages.${system}.coq8_18-koika;
coq8_18-koika = pkgs.coqPackages_8_18.koika;
coqDev-koika = pkgs.coqPackages_koika.koika;
};

apps.makes = makes.apps.${system}.default;
})
// {
# NOTE: To use this flake, apply the following overlay to nixpkgs and use
# koika from its respective coqPackages_VER attribute set!
overlays.default = import ./overlay.nix;
};
}
9 changes: 9 additions & 0 deletions ignored_paths.nix
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"
]
10 changes: 10 additions & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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_18;
}