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

[tools] Initial support for nix shell/develop #3519

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

Conversation

ThomasMader
Copy link

@ThomasMader ThomasMader commented Sep 21, 2024

Nix shell/develop provides similar functionality to 'magic shell' but works with the Nix package manager (https://nixos.org/download/) and is generally used to manage an entire operating system.
Nix does not follow the FHS standard which means that magic does not work on systems using Nix out of the box and providing such a developer environment makes it easier for people using Nix to use and contribute to the software provided by Modular. On a system with a default Nix installation the shell can be entered by going to the mojo repository path and executing 'nix-shell'.
With flake support enabled it also works with 'nix develop'.

The Nix package manager is used in the NixOS Linux distribution and enables the configuration of the entire system declaratively in a functional language also called Nix.
But it can also be used on any other Linux distribution and macOS with the same guarantees as on NixOS with the exception that it uses the base system on the lowest layer in this case instead of it's own kernel.
With https://github.com/NixOS/nixpkgs there exists a repository for packaging software which is also a possible future path with the Modular products but currently I believe that it's not yet feasible.
I thought that the mojo repository is for now the best place to centralize the support for a Nix dev shell even though I realize that this is not something of high importance for Modular.

Nix might also be of interest because it could potentially also being used to build containers (https://nix.dev/tutorials/nixos/building-and-running-docker-images.html) and an increasing number of repositories provide a flake.nix file in the repository to package the current upstream version directly in comparison to the nixpkgs approach.

I know the chances are slim that this gets merged but I thought I will try.

I tested the shell on NixOS but was not able to test on macOS because I don't have access to it.

Anybody interested in trying it out can do so by installing the Nix package manager by following the instructions on https://nixos.org/download and running 'nix-shell' in the mojo repository directory with the nix files present.

Nix shell/develop provides similar functionality to 'magic shell' but works with the
Nix package manager (https://nixos.org/download/) and is generally used to manage
an entire operating system.
Nix does not follow the FHS standard which means that magic does not work on systems
using Nix out of the box and providing such a developer environment makes it easier
for people using Nix to use and contribute to the software provided by Modular.
On a system with a default Nix installation the shell can be entered by going to the
mojo repository path and executing 'nix-shell'.
With flake support enabled it also works with 'nix develop'.

Signed-off-by: Thomas Mader <[email protected]>
@ThomasMader ThomasMader force-pushed the InitialNixDevShellSupport branch from 56e4847 to ff0877d Compare September 26, 2024 18:56
@ThomasMader ThomasMader changed the title Initial support for nix shell/develop [tools] Initial support for nix shell/develop Sep 26, 2024
@JoeLoser
Copy link
Collaborator

While I'd love to support Nix, I don't have any experience in this area, and so am reluctant to have our team maintain support for this right now. Do you have any thoughts here, @zbowling?

@JoeLoser JoeLoser requested a review from zbowling November 22, 2024 04:03
@skongum02 skongum02 deleted the branch modular:main January 29, 2025 18:58
@skongum02 skongum02 closed this Jan 29, 2025
@skongum02 skongum02 reopened this Jan 29, 2025
@skongum02 skongum02 changed the base branch from nightly to main January 29, 2025 20:54
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