Skip to content

feat: Nix Shell #799

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

Merged
merged 29 commits into from
May 13, 2025
Merged

feat: Nix Shell #799

merged 29 commits into from
May 13, 2025

Conversation

maningreen
Copy link
Contributor

@maningreen maningreen commented Mar 31, 2025

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. If this change fixes any issues please put "Fixes #XX" in the description. Please also ensure to add the appropriate labels to the PR.

Guidelines

  • My code follows the style guidelines of this project (formatted with Ruff)

  • I have performed a self-review of my own code

  • I have commented my code, particularly in hard-to-understand areas

  • I have made corresponding changes to the documentation if needed

  • My changes generate no new warnings

  • I have tested this change

  • Any dependent changes have been merged and published in downstream modules

  • I have added all appropriate labels to this PR

  • I have followed all of these guidelines.

How Has This Been Tested? (if applicable)

Ran dev shell and check nix flake show, and built tux from poetry.

Summary by Sourcery

Add Nix development shell configuration for the Tux project, enabling reproducible and consistent development environments across different systems.

New Features:

  • Introduce Nix flake and shell configuration to support cross-platform development environment setup

Enhancements:

  • Configure development shell with Python 3.13 and Poetry
  • Support x86_64 and aarch64 architectures for Linux and macOS

Build:

  • Create Nix flake with support for multiple system architectures
  • Add shell.nix to define development environment dependencies

Copy link
Contributor

sourcery-ai bot commented Mar 31, 2025

Reviewer's Guide by Sourcery

This pull request introduces a Nix flake configuration for the project, enabling reproducible development environments. It includes flake.nix to define the flake, shell.nix to specify the development shell environment with Python 3.13 and Poetry, and a flake.lock file to track dependencies. The .gitignore file is also updated to exclude flake.lock.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Introduces a Nix flake configuration for the project.
  • Adds a flake.nix file to define the project's Nix environment.
  • Specifies the flake's description and input dependencies, including nixpkgs.
  • Defines supported systems for the development shell.
  • Creates a development shell using callPackage and shell.nix.
flake.nix
Introduces a Nix shell definition.
  • Adds a shell.nix file to define the development shell environment.
  • Specifies the packages required for development, including python313 and poetry.
  • Adds a shellHook to enter the user's preferred shell and exit after the child shell exits.
shell.nix
Adds a flake.lock file.
  • Adds a flake.lock file to track the versions of the flake's dependencies.
flake.lock
Updates .gitignore.
  • Adds flake.lock to .gitignore.
.gitignore

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @maningreen - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a .envrc file with direnv to automatically load the environment when entering the project directory.
  • It might be helpful to add some common development tools to the nix shell, such as git or jq.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@midirhee12
Copy link
Contributor

It's ready to merge now.

Copy link
Contributor Author

@maningreen maningreen left a comment

Choose a reason for hiding this comment

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

lgtm

@kzndotsh
Copy link
Contributor

kzndotsh commented Apr 7, 2025

lgtm

Waiting till we merge the pre-0.1 branch into main before accepting as there will likely be merge conflicts / adjustments needing to be made.

@electron271
Copy link
Contributor

pre-0.1 has been merged into main @kzndotsh

@electron271
Copy link
Contributor

@maningreen @midirhee12 whats the progress on this? should it be converted to draft or is it ready to review

@electron271 electron271 added this to the 0.1.0 milestone May 11, 2025
@midirhee12
Copy link
Contributor

@electron271 It should be ready to merge. But I'm going to make a few follow up PRs for database and such. I think it would better to make a separate nix shell for it.

@electron271
Copy link
Contributor

@midirhee12

@electron271 It should be ready to merge. But I'm going to make a few follow up PRs for database and such. I think it would better to make a separate nix shell for it.

alright, ill look into getting someone to review. before i would like to ask is it possible for envrc to just be auto generated from .env.example so we do not have to update it each time .env.example is updated

also keep in mind db stuff will be rewritten in a different ORM

@electron271
Copy link
Contributor

direnv/direnv#284 this has some info, if this is possible please figure out before merging

@midirhee12
Copy link
Contributor

@electron271 Yeah, I can make a shell hook recreate it from the current example. Let me update the PR before merging. Feel free to bug me again if I don't get to it.

@midirhee12
Copy link
Contributor

Ha, I just noticed. Know quite a few of the guys in this issue. I can ask for help if need be. But I think we'll be alright.

@electron271
Copy link
Contributor

@electron271 Yeah, I can make a shell hook recreate it from the current example. Let me update the PR before merging. Feel free to bug me again if I don't get to it.
alright sounds good

@electron271
Copy link
Contributor

@midirhee12 did you forget

@midirhee12
Copy link
Contributor

@electron271 Did not. But thanks for the ping anyways.

@midirhee12
Copy link
Contributor

@maningreen I did the thing. Merge the PR.

@midirhee12
Copy link
Contributor

@electron271 We're ready now

Copy link
Member

@juuyokka juuyokka left a comment

Choose a reason for hiding this comment

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

Looks good to me. Are there plans on using Nix to build/package Tux in the future as well?

@midirhee12
Copy link
Contributor

@juuyokka Yea, I got a whole list of things I want to go after. But I want to piece meal since it's gonna be multiple derivations, multiple shells, a few things to generate docker images, etc.

@electron271 electron271 merged commit 4f3bee8 into allthingslinux:main May 13, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: meta Relating to architecture, systems and critical functions misc: good first issue priority: medium type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants