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 CI #86

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add Nix CI #86

wants to merge 1 commit into from

Conversation

piegamesde
Copy link

Let me know what you think. Closes #81

@piegamesde
Copy link
Author

Obviously, every change to the source will result in having to rebuild everything. However, at the moment, the whole repository is marked as source. This means that even non-code changes or build artifacts will trigger a rebuild. This is not a real problem for the CI, but may be annoying when doing local development.

Having the relevant sources in one folder would make it a lot easier to only select source files for the build input.

Copy link
Owner

@rui314 rui314 left a comment

Choose a reason for hiding this comment

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

Generally looking good. After you filed an issue about Nix for the first time for mold, I investigated a little about Nix, and it looks like it is a good fit for testing mold.

IIUC, one caveat I found in Nix is that a package's hash consists of all hashes of all inputs which are used to build the package. Even if two build results happen to yield the exact same binary, if the toolchains used for building them are different, the results will have different hashes. And that makes other packages' hash values transitively different. So, if we make a code change that doesn't affect the linker's outputs, it still invalidates all binary package caches. Looks like it is a unfortunate consequence how Nix computes package hashes. Anyways, this is not a comment to your code, though.

README.md Outdated Show resolved Hide resolved
default.nix Outdated Show resolved Hide resolved
default.nix Outdated Show resolved Hide resolved
default.nix Outdated Show resolved Hide resolved
default.nix Outdated
nativeBuildInputs = with pkgs; [ clang_12 cmake lld_12 tbb xxHash zlib openssl git ];
dontUseCmakeConfigure = "true";
buildPhase = "make -j $NIX_BUILD_CORES";
installPhase = "mkdir -p $out $out/bin $out/share/man/man1 && PREFIX=$out make install";
Copy link
Owner

Choose a reason for hiding this comment

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

The directories are automatically created if not exist. So make PREFIX=$out install should work.

Copy link
Author

Choose a reason for hiding this comment

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

Interesting, the current failure is a "no such file or directory", probably related to removing the mkdir.

default.nix Outdated Show resolved Hide resolved
@piegamesde
Copy link
Author

Thanks for the review. The hashes are indeed a problem. People are already working on this, see for example NixOS/rfcs#62, but it's a really hard problem so it will take some time.

My packaging of mold was mostly copied from an earlier version of the nixpkgs packaging PR. I pinged you there, please have a look at it.

@rui314
Copy link
Owner

rui314 commented Jul 14, 2021

It looks like CI failed. Can you take a look?

@piegamesde
Copy link
Author

Silly mistake, I should have tried it out locally. It's a bit annoying that you have to enable the CI for my PR every time I push :(

@nehaljwani
Copy link
Contributor

@piegamesde I simply submit a PR to my own fork to test, that way I don't have to wait on approval during testing.

@rui314 rui314 force-pushed the main branch 4 times, most recently from f797b76 to a44de89 Compare February 24, 2022 02:32
@rui314 rui314 force-pushed the main branch 13 times, most recently from 4652763 to 230976a Compare May 1, 2022 08:04
@rui314 rui314 force-pushed the main branch 2 times, most recently from 192efa1 to a1711b9 Compare May 21, 2022 12:31
@rui314 rui314 force-pushed the main branch 3 times, most recently from ccf2cda to 7d91674 Compare August 3, 2022 03:29
@rui314 rui314 force-pushed the main branch 2 times, most recently from bf2c440 to df9e997 Compare December 31, 2022 23:41
@rui314 rui314 force-pushed the main branch 3 times, most recently from cc86039 to 25d02bb Compare January 14, 2023 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nixification
3 participants