Skip to content

Commit

Permalink
Fix build using flake system
Browse files Browse the repository at this point in the history
- Make the project build using flake
- Revert to version of coq that builds without dune version error
- Update flake.nix
  • Loading branch information
redanaheim committed Mar 13, 2024
1 parent e28d8d1 commit 86e88a4
Show file tree
Hide file tree
Showing 8 changed files with 5,630 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ language-server/_build
client/yarn-error.log
client/.vscode-test/
client/out/
.DS_Store
result
1,085 changes: 1,085 additions & 0 deletions client/goal-view-ui/yarn.nix

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@
"start:search-ui": "cd search-ui && yarn run start",
"build:search-ui": "cd search-ui && yarn run build",
"build:dev:search-ui": "cd search-ui && yarn run build:dev",
"vscode:prepublish": "yarn run package",
"compile": "webpack",
"watch": "webpack --watch",
"package": "yarn run install:all && yarn run build:all && webpack --mode production --devtool hidden-source-map",
Expand Down
1,109 changes: 1,109 additions & 0 deletions client/search-ui/yarn.nix

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function activate(context: ExtensionContext) {
const vscoq1 = extensions.getExtension("coq-community.vscoq1");
if (vscoq1) {
if (vscoq1.isActive) {
const message = "VsCoq2 is incompatible with VsCoq1 it is recommended that you disable one of them.";
const message = "VsCoq2 is incompatible with VsCoq1. it is recommended that you disable one of them.";
window.showErrorMessage(message, { title: "Disable VsCoq1", id: 0 }, { title: "Disable VsCoq2", id: 1 })
.then(act => {
if (act?.id === 0) {
Expand Down
3,373 changes: 3,373 additions & 0 deletions client/yarn.nix

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions flake.lock

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

54 changes: 50 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

flake-utils.url = "github:numtide/flake-utils";

coq-master = { url = "github:coq/coq/e0058c7b266aa43b3c23fbb4c2e7a127512c8667"; }; # Should be kept in sync with PIN_COQ in CI workflow
coq-master = { url = "github:coq/coq/8152d125abb0fb7e8cbecf4bd6cd51d8d3e70d78"; }; # Should be kept in sync with PIN_COQ in CI workflow
coq-master.inputs.nixpkgs.follows = "nixpkgs";

};
Expand All @@ -14,7 +14,7 @@
flake-utils.lib.eachDefaultSystem (system:

let vscoq_version = "2.1.2"; in
let coq = coq-master.defaultPackage.${system}; in
let coq = coq-master.packages.${system}; in
rec {

packages.default = self.packages.${system}.vscoq-language-server-coq-8-19;
Expand All @@ -23,11 +23,15 @@
# Notice the reference to nixpkgs here.
with import nixpkgs { inherit system; };
let ocamlPackages = ocaml-ng.ocamlPackages_4_14; in

ocamlPackages.buildDunePackage {
duneVersion = "3";
pname = "vscoq-language-server";
version = vscoq_version;
src = ./language-server;
nativeBuildInputs = [
coq_8_18
];
buildInputs = [
coq_8_18
dune_3
Expand Down Expand Up @@ -62,6 +66,9 @@
pname = "vscoq-language-server";
version = vscoq_version;
src = ./language-server;
nativeBuildInputs = [
coq_8_19
];
buildInputs = [
coq_8_19
dune_3
Expand Down Expand Up @@ -96,6 +103,9 @@
pname = "vscoq-language-server";
version = vscoq_version;
src = ./language-server;
nativeBuildInputs = [
coq
];
buildInputs = [
coq
dune_3
Expand Down Expand Up @@ -123,15 +133,51 @@

packages.vscoq-client =
with import nixpkgs { inherit system; };

let yarn_deps = (name: (path: (mkYarnModules {
pname = "${name}_yarn_deps";
version = vscoq_version;
packageJSON = ./${path}/package.json;
yarnLock = ./${path}/yarn.lock;
yarnNix = ./${path}/yarn.nix;
}))); in

let client_deps = yarn_deps "client" /client; in
let goal_view_ui_deps = yarn_deps "goal_ui" /client/goal-view-ui; in
let search_ui_deps = yarn_deps "search_ui" /client/search-ui; in
let link_deps = (x: (p: (''
ln -s ${x}/node_modules ${p}
export PATH=${x}/node_modules/.bin:$PATH
''))); in
let links = [
(link_deps client_deps ".")
(link_deps goal_view_ui_deps "./goal-view-ui")
(link_deps search_ui_deps "./search-ui")
]; in
let cmds = builtins.concatStringsSep "\n" links; in

stdenv.mkDerivation rec {

name = "vscoq-client";
src = ./client;

buildInputs = [
nativeBuildInputs = [
nodejs
yarn
];
] ++ [client_deps goal_view_ui_deps search_ui_deps];

buildPhase = cmds + ''
cd goal-view-ui
yarn run build
cd ../search-ui
yarn run build
cd ..
webpack --mode=production --devtool hidden-source-map
bash -c "yes y | vsce package"
mv *.vsix vscoq-client.vsix
mkdir -p $out/bin
cp ./vscoq-client.vsix $out/bin
'';

};

Expand Down

0 comments on commit 86e88a4

Please sign in to comment.