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

Add Nix flake derivation #2644

Merged
merged 19 commits into from
Jun 17, 2022
Merged

Add Nix flake derivation #2644

merged 19 commits into from
Jun 17, 2022

Conversation

goodlyrottenapple
Copy link
Contributor

@goodlyrottenapple goodlyrottenapple commented Jun 7, 2022

This PR adds an alternative way of building K using the (currently) experimental flakes feature, as per #2607. The flake is largely independent of the current nix derivation, however since it uses the current nix/k.nix file, some tweaks had to be made to make sure this derivation builds both with the current default.nix file and the new flake.nix. The changes to nix/k.nix mostly involve pulling out the ttuegel functions for cleaning the git source out of nix/k.nix into default.nix and passing in the cleaned source as a function argument to nix/k.nix directly.

The changes to shell.nix and test.nix are mainly cosmetic.

Before the new flake derivation can replace the current one in the CI, tests.nix has to be ported into the flake.

haskell-backend
mavenix.cli
];
buildInputs = [ llvm-backend haskell-backend mavenix.cli ];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nixfmt formatting changes

haskell-backend
mavenix.cli
];
buildInputs = [ llvm-backend haskell-backend mavenix.cli ];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nixfmt formatting changes

"KORE_PRINT=kore-print"
"PACKAGE_VERSION=${lib.fileContents ./package/version}"
"--output-sync"
] ++ lib.optional (test != null) "-C ${test}";
enableParallelBuilding = true;
preBuild = ''
cd tests/regression-new
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nixfmt formatting changes

"KORE_PRINT=kore-print"
"PACKAGE_VERSION=${lib.fileContents ./package/version}"
"--output-sync"
] ++ lib.optional (test != null) "-C ${test}";
enableParallelBuilding = true;
preBuild = ''
cd tests/regression-new
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nixfmt formatting changes

mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
in mkSources (mkConfig { }) // {
__functor = _: settings: mkSources (mkConfig settings);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nixfmt formatting changes

mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
in mkSources (mkConfig { }) // {
__functor = _: settings: mkSources (mkConfig settings);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nixfmt formatting changes

in mkShell {
buildInputs = [ mavenix.cli ];
}
in mkShell { buildInputs = [ mavenix.cli ]; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nixfmt formatting changes

in mkShell {
buildInputs = [ mavenix.cli ];
}
in mkShell { buildInputs = [ mavenix.cli ]; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nixfmt formatting changes

Comment on lines +33 to +48
src = ttuegel.cleanSourceWith {
name = "k";
src = ttuegel.cleanGit {
src = ./.;
name = "k";
};
ignore = [
"result*"
"nix/"
"*.nix"
"haskell-backend/src/main/native/haskell-backend/*"
"llvm-backend/src/main/native/llvm-backend/*"
"!llvm-backend/src/main/native/llvm-backend/matching" # need pom.xml
"k-distribution/tests/regression-new"
];
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the source cleaning out of nix/k.nix since the flkae re-uses the same expression and does its own source cleaning

Comment on lines +33 to +48
src = ttuegel.cleanSourceWith {
name = "k";
src = ttuegel.cleanGit {
src = ./.;
name = "k";
};
ignore = [
"result*"
"nix/"
"*.nix"
"haskell-backend/src/main/native/haskell-backend/*"
"llvm-backend/src/main/native/llvm-backend/*"
"!llvm-backend/src/main/native/llvm-backend/matching" # need pom.xml
"k-distribution/tests/regression-new"
];
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the source cleaning out of nix/k.nix since the flkae re-uses the same expression and does its own source cleaning

Comment on lines +50 to +54
debugger =
if pkgs.system == "x86_64-darwin" || pkgs.system == "aarch64-darwin" then
pkgs.lldb
else
pkgs.gdb;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added gdb/lldb as a runtime dependency to the k binaries

Comment on lines +50 to +54
debugger =
if pkgs.system == "x86_64-darwin" || pkgs.system == "aarch64-darwin" then
pkgs.lldb
else
pkgs.gdb;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added gdb/lldb as a runtime dependency to the k binaries

@calin1304
Copy link

LGTM

@rv-jenkins rv-jenkins merged commit b1c8430 into master Jun 17, 2022
@rv-jenkins rv-jenkins deleted the nix_flake branch June 17, 2022 14:16
F-WRunTime pushed a commit that referenced this pull request Jun 21, 2022
* new nix flake

* bump llvm and haskell deps

* updatde llvm-backend

* bump llvm-backend

* cleanup and new pinned versions

* llvm-backend now pinned to master

* revert clang dependency + replace ln -s with ln -sf

* add overlays

* added gdb/lldb to runtime dependecnies of all k execs

* remove krun change

* add proper versioning to nix expression

* flake.lock

* haskell-backend now tracs master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants