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

dev: Adding shell.nix for development environments #1850

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

Conversation

jzbor
Copy link

@jzbor jzbor commented Sep 4, 2023

This adds a shell.nix file to easily create a somewhat reproducible development environment with nix. It does require Nix to be installed, but may be a "lighter" alternative to Docker. Accompanying documentation is also provided.

@github-actions
Copy link

github-actions bot commented Sep 4, 2023

Build checks have not completed. Possible reasons for this are:

  1. The checks need to be approved by a maintainer
  2. The branch has conflicts
  3. The firmware build has failed

@blm768
Copy link
Contributor

blm768 commented Sep 4, 2023

The errors seem to be non-deterministic. I'll try this without the package cache.

Whoops; posted this on the wrong issue thread.

@blm768
Copy link
Contributor

blm768 commented Sep 5, 2023

This is downright delightful, at least for us Nix users! I can think of a couple of minor potential downsides, but I'm not sure they're huge ones:

  • This is another (small) bit of code to maintain.
  • The compiler version may be subtly different from the one used in CI. I'd say the risk of breakage is probably relatively low, though. (?)

On the upside, Nix evaluations can be quite cacheable (especially using flakes); we could build on this to cache dependency installations between CI runs if we used Nix instead of Docker for CI.

This would also pair nicely with a .envrc:

#!/usr/bin/env bash
watch_file shell.nix
use nix

@FintasticMan
Copy link
Member

I wouldn't worry much about the compiler version; InfiniTime works with most versions. What I do worry about is the nRF SDK version. I can't see that this specifies a version to use, and InfiniTime definitely requires the specific version we mention in the docs. Is there a way to specify that?

@jzbor
Copy link
Author

jzbor commented Sep 5, 2023

Yes that should be possible. What Version does InfiniTime require?

@FintasticMan
Copy link
Member

InfiniTime requires 15.3.0.

This adds a shell.nix file to easily create a somewhat reproducible development environment with nix. It does require Nix to be installed, but may be a "lighter" alternative to Docker. Accompanying documentation is also provided.
@jzbor
Copy link
Author

jzbor commented Sep 5, 2023

I have now pinned the nrf-sdk version to 15.3.0.

It should also be mentioned that it is possible to pin nixpkgs altogether, making the environment completely reproducible. However this requires the use of Flakes, which are not officially stable yet (although widely used). It also comes with the maintenance burden of keeping the Flake up-to-date, so I think a simple shell.nix is still the best fit here.

@jzbor
Copy link
Author

jzbor commented Sep 21, 2023

Are there any updates? Is there still an interest in merging this?

@blm768
Copy link
Contributor

blm768 commented Sep 22, 2023

I'm certainly interested in using this as a NixOS user. With the errors I'm getting from the Docker container, this is currently my only way to build the project on NixOS.

@icewind1991
Copy link

I've created a flake for building infinitime to make it easy to create patched builds on nixos: https://github.com/icewind1991/infinitime-builder

shymega added a commit to shymega/InfiniTime that referenced this pull request Sep 11, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is.

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.
shymega added a commit to shymega/InfiniTime that referenced this pull request Sep 11, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.
shymega added a commit to shymega/InfiniTime that referenced this pull request Sep 11, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Sep 14, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Oct 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Oct 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Oct 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Oct 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Oct 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Oct 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Oct 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Oct 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Nov 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Nov 13, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[email protected]>
shymega added a commit to shymega/InfiniTime that referenced this pull request Nov 17, 2024
This PR introduces a Nix flake, allowing for InfiniTime to be built as a
Flake, including a FHS development environment.

It's derived from InfiniTimeOrg#1850 and
icewind1991/infinitime-builder@c57c57f.

We also introduce `flake-compat`, allowing for non-Flake Nix mahcines to
use the project as-is, both for building (`default.nix`), and
development (`shell.nix`).

Additionally, we introduce `.envrc`, meaning that with `direnv`, the Nix
Flake is activated automatically.

Fixes InfiniTimeOrg#1850.

Signed-off-by: Dom Rodriguez <[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.

4 participants