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

Nixos support #199

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Nixos support #199

merged 1 commit into from
Feb 29, 2024

Conversation

timlinux
Copy link
Member

@timlinux timlinux commented Feb 29, 2024

This PR adds convenience tools for working with the project in Nixos and VSCode. It adds extensions that make working with Hugo easier in VSCode. The list-vscode-extensions.sh is a convenience tool to enumerate the installed VSCode extensions.

Summary by CodeRabbit

  • New Features
    • Introduced Nix for environment management.
    • Added a script for listing and installing Visual Studio Code extensions.
    • Set up a development environment for Hugo projects with specific configurations for VSCode.
  • Chores
    • Updated .gitignore to exclude .vscode-extensions/ directory.

Copy link
Contributor

coderabbitai bot commented Feb 29, 2024

Walkthrough

The project introduces a comprehensive enhancement for environment management and development workflow with Nix and Visual Studio Code. It focuses on automating the setup for a Hugo project, managing VSCode extensions more efficiently, and ensuring a cleaner repository by ignoring unnecessary files. This update streamlines the development process, making it easier to maintain and collaborate on the project.

Changes

File(s) Summary
.envrc Introduces Nix for environment management.
.gitignore Adds .vscode-extensions/ to ignored files and directories.
list-vscode-extensions.sh, vscode.sh Bash scripts for managing and launching VSCode extensions.
shell.nix Sets up a Hugo project development environment with Hugo and VSCode as build inputs.

🐇✨
In a burrow, deep and wide,
A rabbit worked with code inside.
With Nix and shells, and scripts so neat,
The environment was made complete.
"Hop in," it said, "the code's just right,
For building dreams in bytes tonight."
🌟🐾

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 48bc98f and 7bb8f81.
Files selected for processing (5)
  • .envrc (1 hunks)
  • .gitignore (2 hunks)
  • list-vscode-extensions.sh (1 hunks)
  • shell.nix (1 hunks)
  • vscode.sh (1 hunks)
Additional comments: 4
.envrc (1)
  • 1-1: The directive use nix is correctly used to enable Nix for environment management. This is a standard and recommended approach for projects utilizing Nix, ensuring a consistent development environment.
vscode.sh (1)
  • 1-3: The script vscode.sh correctly launches VSCode with a specified extensions directory, enhancing the development experience by allowing developers to use a consistent set of extensions. The shebang and command syntax are correctly used.
list-vscode-extensions.sh (1)
  • 1-3: The script list-vscode-extensions.sh effectively lists installed VSCode extensions and formats the output to generate installation commands. This facilitates easy management and replication of VSCode setups across different environments. The shebang and command syntax are correctly used.
.gitignore (1)
  • 12-12: The addition of .vscode-extensions/ to the .gitignore file is a good practice, ensuring that personal or local development environment configurations are not shared across all developers. This keeps the repository clean and focused on essential files.

Comment on lines +1 to +32
let
nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8.tar.gz";
pkgs = import nixpkgs { config = { }; overlays = [ ]; };
in
with pkgs;
mkShell {
buildInputs = [
hugo
vscode
];
# DIRENV_LOG_FORMAT to reduce direnv verbosity
# See https://github.com/direnv/direnv/issues/68#issuecomment-162639262
shellHook = ''
export DIRENV_LOG_FORMAT=
echo "-----------------------"
echo "🌈 Your Hugo Dev Environment is ready."
echo "It provides hugo and vscode for use with the QGIS Hugo Project"
echo ""
echo "🪛 Installing VSCode Extensions:"
echo "--------------------------------"
code --extensions-dir=".vscode-extensions" --install-extension maziac.asm-code-lens
echo ""
echo "📒 Note:"
echo "-----------------------"
echo "start vscode like this:"
echo ""
echo "code --extensions-dir=\".vscode-extensions\" ."
echo "-----------------------"
'';
postShellHook = ''
'';
}
Copy link
Contributor

@coderabbitai coderabbitai bot Feb 29, 2024

Choose a reason for hiding this comment

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

The shell.nix file correctly sets up a development environment tailored for Hugo projects, including Hugo and VSCode as build inputs. The use of a specific commit hash for fetching Nix packages ensures a stable and reproducible environment. The shell hook enhances usability by installing VSCode extensions and providing clear instructions for launching VSCode.

However, for clarity and maintainability, consider adding comments to explain the choice of the specific VSCode extension (maziac.asm-code-lens) and its relevance to the Hugo project. This will help future contributors understand the rationale behind these choices.

+ # The maziac.asm-code-lens extension is included for [reason]. It's particularly useful for [use case].

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
let
nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8.tar.gz";
pkgs = import nixpkgs { config = { }; overlays = [ ]; };
in
with pkgs;
mkShell {
buildInputs = [
hugo
vscode
];
# DIRENV_LOG_FORMAT to reduce direnv verbosity
# See https://github.com/direnv/direnv/issues/68#issuecomment-162639262
shellHook = ''
export DIRENV_LOG_FORMAT=
echo "-----------------------"
echo "🌈 Your Hugo Dev Environment is ready."
echo "It provides hugo and vscode for use with the QGIS Hugo Project"
echo ""
echo "🪛 Installing VSCode Extensions:"
echo "--------------------------------"
code --extensions-dir=".vscode-extensions" --install-extension maziac.asm-code-lens
echo ""
echo "📒 Note:"
echo "-----------------------"
echo "start vscode like this:"
echo ""
echo "code --extensions-dir=\".vscode-extensions\" ."
echo "-----------------------"
'';
postShellHook = ''
'';
}
let
nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8.tar.gz";
pkgs = import nixpkgs { config = { }; overlays = [ ]; };
in
with pkgs;
mkShell {
buildInputs = [
hugo
vscode
];
# DIRENV_LOG_FORMAT to reduce direnv verbosity
# See https://github.com/direnv/direnv/issues/68#issuecomment-162639262
shellHook = ''
export DIRENV_LOG_FORMAT=
echo "-----------------------"
echo "🌈 Your Hugo Dev Environment is ready."
echo "It provides hugo and vscode for use with the QGIS Hugo Project"
echo ""
echo "🪛 Installing VSCode Extensions:"
echo "--------------------------------"
# The maziac.asm-code-lens extension is included for [reason]. It's particularly useful for [use case].
code --extensions-dir=".vscode-extensions" --install-extension maziac.asm-code-lens
echo ""
echo "📒 Note:"
echo "-----------------------"
echo "start vscode like this:"
echo ""
echo "code --extensions-dir=\".vscode-extensions\" ."
echo "-----------------------"
'';
postShellHook = ''
'';
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Hold please before merging

Copy link
Contributor

Choose a reason for hiding this comment

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

@timlinux, I've noted your request to hold off on merging the PR. If there are specific concerns or additional changes that need to be addressed, please let me know how I can assist.

@timlinux timlinux merged commit 7bb8f81 into qgis:main Feb 29, 2024
1 of 2 checks passed
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.

1 participant