-
-
Notifications
You must be signed in to change notification settings - Fork 199
Make Nix flakes a first class citizen, fix various issues with modern compilers #317
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
Conversation
They are a PITA when rebasing and what not. I prefer to enforce style via CI checks.
A bit of noise because of cmake-format being run
Let's follow stable releases for now...
This brings back compatibility with the changes introduced in this PR: arximboldi/immer#317
This brings back compatibility with the changes introduced in this PR: arximboldi/immer#317
|
CIFuzz will pass once this is merged: google/oss-fuzz#14770 |
|
nvm, just saw they take some time to deal with PR's on oss-fuzz these days so added some backwards compatibility to unblock this |
| inputs = { | ||
| nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable; | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; | ||
| flake-utils.url = "github:numtide/flake-utils"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't need that anymore
https://zero-to-nix.com/concepts/flakes/#system-specificity
# The set of systems to provide outputs for
allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
# A function that provides a system-specific Nixpkgs for the desired systems
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in {
packages = forAllSystems ({ pkgs }: {
default = {
# Package definition
};
});
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat. Yet that puts the burdenn on us on updating the list of systems when nixpkgs updates, I think for now I find depending on flake-utils ok-ish, it seems to be the "de facto" standard... (I wish it was provided by nixpkgs itself to be honest).
90b6a2e to
8613835
Compare
| NONIUS_BENCHMARK("boost::flat_set", benchmark_erase_mut_std<generator__, boost::container::flat_set<t__>>()) | ||
|
|
||
| // seems to fail to compile with recent boost/gcc combinations | ||
| // NONIUS_BENCHMARK("boost::flat_set", benchmark_erase_mut_std<generator__, boost::container::flat_set<t__>>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so flat_set is no longer supported by boost or what's the status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but there was some weird interaction between its current implementation, GCC, and passing an immer::box to erase() that I couldn't fully figure out, so decided to disable this for now just to move on... it's not a big deal.
| { | ||
| using cereal::prologue; | ||
| prologue(ar.previous, std::forward<T>(v)); | ||
| prologue(ar.previous, v); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What motivated this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compilation error on GCC. The T&& argument made the call ambiguous, had to change to const T&, and therefore the forwarding had to go as well.
alex-sparus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me. Just a couple questions, otherwise - approved.
|
@arximboldi Been busy with other stuff, but will confirm it works on my end. |
|
@arximboldi @alex-sparus Unrelated to this PR, but the build with |
This PR picks up on the nice work by @alex-sparus adding a
flake.nixand integration with Nix flakes. In the process, I've updatednixpkgsand tested with more recent compilers and more variety of systems (this simple trick is so lovely, I love Nix <3). This finally closes #307, sorry it took so long!I'm kind of late to the party, but after having gotten more experience with Flakes in other places (mostly the NixOS configurations of my private machines and servers) I am convinced that the benefits in reproducibility and dependency management outweight some of the disadvantages (initially esoteric syntax, that
flake-utilsis kinda needed to deal with systems in a somewhat sane-ish way, etc.).nix developis just so fast, it deprecates my old hacks I had to deal withnix-shellslowness.Along the way, I've built some set of opinions that I've implemented in this PR. I hope Alex doesn't get too annoyed:
I've removed formatting via git hooks. I just find git hooks changing the code a PITA. It sometimes messes things up during interactive rebases. Also it means the git hooks sudenly have dependencies into the nix store and you can't even make a tiny change after, let's say, you
nix-collect-garbage. Plus the editors sometimes get confused when the files magically change. I would prefer to add a CI check for the format, to act as a little reminder to set it up on a text editor level, which is where I believe this belongs (there are.dir-locals.elfor Emacs users already in the repo).nix-shellandnix-buildstill work, and they do ideally more or less the same asnix develop,nix build. There are situations where I think it's still nice to use them.They work via a lightweight
nix/flake-compat.nixthat I reckon is nicer than having to depend on https://github.com/NixOS/flake-compat (also there are some subtle differences, particularly regarding passing the source files, which I believe are nicer this way).I try keep actual derivation definitions outside of
flake.nix. The multiple level of nesting (outputs.<system>.packages, etc.) plus the wide surface of the Flake (checks, shells, packages, etc.) make it easily get out of hand and hard to understand. I prefer for it to be just "glue" that uses derivations defined in other files (mostlyshell.nix,default.nixandnix/immer.nixitself).I have removed a lot of the flake inputs and changed them to manual fetchers. This is my general guideline in this regard:
nixpkgsand for dependencies that are flakes themselves, specially if you need to override inputs (via.follows). Specially stuff that you want to update often and that is used mostly inflake.nixor globally.In this case, the overhead of having to copy the SHA when updating is overshadowed by the benefit of having the definition close to its use. I would say, this is even advantageous friction: e.g. when you update a package source, you need to make sure that the recipe for building it that surrounds it still compiles, and you don't want the thing to be updated carelessly on each
flake update.Also, this has the advantage that you can copy-paste easily package definitions between projects, instead of having to also copy bits from flake and lock files (or having to re-glue everything together if copying into something that doesn't use flakes). I even apply this rationale for some pinnings of
nixpkgsto get very old packages that are used in very specific contexes (e.g. seenix/docs.nix).Over the next days I'll follow up with similar PR's on
zugandlager.Any objections @alex-sparus, @barracuda156?