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

fixes the build on NixOS #20

Merged
merged 4 commits into from
Jan 27, 2021
Merged

fixes the build on NixOS #20

merged 4 commits into from
Jan 27, 2021

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Jan 27, 2021

Two changes that were needed to make it work on NixOS.

@zimbatm zimbatm requested a review from Rizary January 27, 2021 09:51
@Rizary
Copy link
Contributor

Rizary commented Jan 27, 2021

@zimbatm I think we should also pick https://github.com/oxalica/rust-overlay as our default's rust overlay.

Also, we haven't implemented the buildRustPackage in this repo. I think this PR should also address that.

@Rizary Rizary self-assigned this Jan 27, 2021
@zimbatm
Copy link
Member Author

zimbatm commented Jan 27, 2021

Let's address those separately. This fixes the immediate problem. We can always improve afterward.

It is not being used right now and depends on libcurl and zlib
Rust need a CC to compile some of the stuff. Since LLVM is being used by
Rust and clang is also working on darwin, use that.
@Rizary
Copy link
Contributor

Rizary commented Jan 27, 2021

@zimbatm my latest commit should address it.

Copy link
Contributor

@basile-henry basile-henry left a comment

Choose a reason for hiding this comment

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

I am not really familiar with flakes so it took me a bit of time to test this.

nix build .#bin seems to work just fine for me on NixOS

However nix-shell doesn't work any more:

➜ nix-shell
nix-shell: src/libfetchers/tarball.cc:67: nix::fetchers::DownloadFileResult nix::fetchers::downloadFile(nix::ref<nix::Store>, const string&, const string&, bool, const Headers&): Assertion `request.expectedETag == res.etag' failed.
Aborted (core dumped)

And I get a similar error for a simple nix-build

It could be something on my side 🤷‍♂️

devshell.nix Show resolved Hide resolved
@zimbatm
Copy link
Member Author

zimbatm commented Jan 27, 2021

nix-shell: src/libfetchers/tarball.cc:67: nix::fetchers::DownloadFileResult nix::fetchers::downloadFile(nix::refnix::Store, const string&, const string&, bool, const Headers&): Assertion `request.expectedETag == res.etag' failed.

This is an issue with Nix. GitHub has changed their API which breaks some internal assumption that Nix does. rm -rf ~/.cache/nix temporarily works around that issue.

@zimbatm
Copy link
Member Author

zimbatm commented Jan 27, 2021

I don't think we should be using Flakes as it's unstable and not necessary.

@@ -30,7 +24,7 @@
];
};
overlays = [
(import mozilla-overlay)
Copy link
Member Author

Choose a reason for hiding this comment

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

What is the advantage of using an overlay over rust that is in nixpkgs?

Copy link
Contributor

Choose a reason for hiding this comment

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

there is no advantage. It is only for development. You can just use rust-bin.latest.stable.rust and you get the set of toolchain. I can't have it if we use nixpkgs.

@Rizary
Copy link
Contributor

Rizary commented Jan 27, 2021

It could be something on my side 🤷‍♂️

I'm using WSL2 and it's fine to use nix-build and nix-shell. What nix version are you using?

@basile-henry
Copy link
Contributor

jonas' rm -rf ~/.cache/nix fixed my issue 😄

I can nix-build -A defaultNix.outputs.packages.x86_64-linux.bin and nix-shell just fine now.

@Rizary
Copy link
Contributor

Rizary commented Jan 27, 2021

I don't think we should be using Flakes as it's unstable and not necessary.

I don't have any preference on this, I am okay with or without flakes.

@zimbatm zimbatm merged commit 3852256 into master Jan 27, 2021
@zimbatm zimbatm deleted the fix-nixos-build branch January 27, 2021 13:39
brianmcgee added a commit that referenced this pull request May 13, 2024
Allows specifying the order in which formatters are applied.

Very simple for now, adding a `Before` field to the formatted config which allows the user to say that formatter `x` needs to be applied _before_ formatted `y`.

```toml
[formatter.statix]
command = "statix"
includes = ["*.nix"]
before = "deadnix"

[formatter.deadnix]
command = "statix"
includes = ["*.nix"]
```

Signed-off-by: Brian McGee <[email protected]>
Reviewed-on: https://git.numtide.com/numtide/treefmt/pulls/20
Reviewed-by: Jonas Chevalier <[email protected]>
Co-authored-by: Brian McGee <[email protected]>
Co-committed-by: Brian McGee <[email protected]>
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.

3 participants