-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
update nix and add dev shell #769
update nix and add dev shell #769
Conversation
We update the lock on the nix flake and also add a dev shell. This means you can do `nix build` to build the project and `nix develop` to drop into a development environment with cmake and clang. Signed-off-by: Ali Caglayan <alizter@gmail.com>
Thank you! I need to spend some time to understand nix again. Thanks for your patience. |
No worries! Let me know if you have any questions. |
let pkgs = import nixpkgs { inherit system; }; in | ||
let llvm = pkgs.llvmPackages_latest; in | ||
{ | ||
packages = rec { |
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.
Question: I observed the construct with:
packages = rec {
default = ...
ftxui = default
}
worked better than:
packages.ftxui = ...
I don't understand why. Would you have an explanation?
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.
Hi, good question! When you go to a project and do a literal nix build
then nix tries to build the "default" package in the flake. The previous setup called this ftxui
which is not really useful since there is basically only one package to build here. I therefore renamed the existing packages.ftxui
to packages.default
, allowing nix build
to work without any extra arguments.
In order to not break anybody else's workflow, I added packages.ftxui
back in as an alias of packages.default
. In Nix, if you are defining a set where one element refers to another at the time of definition, you will need it to be a recursive definition, hence the rec
flag.
If you are happy with the rename, you can remove packages.ftxui
and the rec
flag. (You might have to also update any documentation you have for building the flake).
Also, notice that the default devShell is called devShells.default
which allows you to do a simple nix develop
in the repo in order to setup a dev environment. This is different from building the project as it also setups the development tools. In this case clang and cmake.
Hopefully that clears some things up!
Thanks! |
We update the lock on the nix flake and also add a dev shell. This means you can do `nix build` to build the project and `nix develop` to drop into a development environment with cmake and clang. Signed-off-by: Ali Caglayan <alizter@gmail.com> Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
We update the lock on the nix flake and also add a dev shell. This means you can do
nix build
to build the project andnix develop
to drop into a development environment with cmake and clang.