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

feature: installer image #603

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

feature: installer image #603

wants to merge 24 commits into from

Conversation

NobbZ
Copy link
Owner

@NobbZ NobbZ commented Jul 24, 2023

Summary by CodeRabbit

  • New Features
    • Introduced enhanced system customization with a new debugging option and tailored configuration settings.
    • Added a bootable installer tool that generates disk images and ISO files, alongside a preview mode for a popular window manager.
    • Upgraded system modules to improve network management, display handling, storage services, and system messaging.
    • Integrated Neovim as the default editor and expanded development tools with Lua language support.

@NobbZ NobbZ self-assigned this Jul 24, 2023
@NobbZ NobbZ force-pushed the installer branch 2 times, most recently from b447883 to 592e118 Compare August 25, 2023 21:30
@NobbZ NobbZ force-pushed the installer branch 2 times, most recently from 816fa67 to 2580a8a Compare June 27, 2024 07:14
NobbZ added 3 commits March 1, 2025 10:53
This crash was from the vmware mouse-drivers. Issue has been mitigated by disabling VMware
guest integration, which I will probably never need anyway
Copy link

coderabbitai bot commented Mar 1, 2025

📝 Walkthrough

Walkthrough

The changes update the system’s Nix configuration by adding a debugging flag and a system-specific configuration structure within the flake. Two new applications—one for installing the system (creating disk images, ISOs, and launching QEMU) and another for previewing the Awesome window manager (configuring and launching via Xephyr)—are introduced. Additionally, a new "awesome" entry is added to the npins sources, and package definitions are extended with an awesome override and an installer-iso. Multiple installer modules now configure services for LVM, MOTD, Neovim, network, SDDM, and XTerm. The development shell is enhanced with lua-language-server.

Changes

File(s) Change Summary
flake.nix Added debug flag and perSystem attribute with new applications: apps.installer.program and apps.awesome-preview.program.
npins/sources.json Added new "awesome" entry with GitHub repository details, branch, revision, tarball URL, and hash.
packages/default.nix Updated function signature to include npins; defined an awesome variable overriding package attributes and introduced a new installer-iso package.
packages/installer/{awesome.nix, awesomerc.lua, base.nix, default.nix, lvm.nix, motd.nix, neovim.nix, network.nix, sddm.nix, xterm.nix} Introduced several installer configuration files defining Awesome WM settings, installer ISO build, LVM, MOTD, Neovim, network manager, SDDM, and XTerm service configurations.
parts/auxiliary.nix Modified the devShells default package list to include lua-language-server.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant InstallerScript
    participant QEMU
    User->>InstallerScript: Start installer
    InstallerScript->>InstallerScript: Check for disk image & build ISO
    InstallerScript->>QEMU: Launch virtual machine with parameters
    QEMU-->>InstallerScript: VM execution complete
    InstallerScript->>User: Display ISO info and cleanup actions
Loading
sequenceDiagram
    participant User
    participant AwesomePreview
    participant LuaConfig
    participant Xephyr
    User->>AwesomePreview: Request Awesome WM preview
    AwesomePreview->>LuaConfig: Generate awesomerc.lua configuration
    AwesomePreview->>Xephyr: Launch nested Awesome WM session
    Xephyr-->>User: Render Awesome WM interface
Loading

Poem

I’m a rabbit in code, leaping through new arrays,
With debug hops and installer plays.
Awesome configs now pave the way,
Scripts and services make my day.
Carrots and code—let’s celebrate in many ways!
🥕🐇

✨ Finishing Touches
  • 📝 Generate Docstrings

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>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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.

Actionable comments posted: 1

🧹 Nitpick comments (6)
packages/installer/motd.nix (1)

4-23: Informative MOTD with helpful user guidance.

The message content provides valuable information about the environment and keybindings for users unfamiliar with the Awesome window manager.

I noticed line 19 has <s>Rofi is available as well, you can open it by pressing <tt>Mod4+d</tt>.</s>. The strikethrough suggests this functionality isn't actually available. Consider either:

  1. Removing this line completely
  2. Implementing the Rofi binding if it's intended to be available
  3. Clarifying why this information is struck through
packages/installer/awesome.nix (1)

25-34: Duplicate awesome package override definition.

This awesome package override is identical to the one in packages/default.nix (lines 21-30). Having the same definition in two places creates maintenance challenges if changes are needed in the future.

Consider defining the awesome package override in one location and importing it where needed, or passing it as a parameter between the files.

flake.nix (2)

6-7: Consider making debug optional or environment-driven.
Enabling debugging unconditionally may produce excessive logs or degrade performance in production scenarios. Allowing a dynamic toggle could be a more flexible approach.

Here is an example diff to make debug honor an environment variable:

- debug = true;
+ debug = builtins.getEnv "DEBUG" == "1";

58-68: Consider gracefully handling Xephyr to avoid leftover processes.
Launching Xephyr in the background without cleanup may leave it running if the script exits unexpectedly. Adding a trap to kill Xephyr or storing its PID could provide a safer termination strategy.

A possible snippet:

 pkgs.writeShellScriptBin "awesome-preview" ''
   xephyrPid="$(${pkgs.xorg.xorgserver}/bin/Xephyr :5 &)"; sleep 1
+  trap "kill $xephyrPid" EXIT
   DISPLAY=:5 ${self'.packages.awesome}/bin/awesome --config ${rc_lua}
 '';
packages/installer/awesomerc.lua (2)

110-128: Ensure wallpaper scaling for different screen resolutions.
While this approach sets a single wallpaper, it may appear stretched or cropped on varying screen sizes. Consider adding logic to preserve aspect ratio or select different images per screen.


610-612: Sloppy focus can be disorienting for some users.
Focus follows the mouse by default here, which is a personal preference. You might consider making it optional or documenting it so that users understand this behavior.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e7dacc and 9405f62.

⛔ Files ignored due to path filters (8)
  • packages/installer/icons/globe.svg is excluded by !**/*.svg
  • packages/installer/icons/manual.svg is excluded by !**/*.svg
  • packages/installer/icons/nix-flake.svg is excluded by !**/*.svg
  • packages/installer/icons/parted.svg is excluded by !**/*.svg
  • packages/installer/icons/power-off.svg is excluded by !**/*.svg
  • packages/installer/icons/reboot.svg is excluded by !**/*.svg
  • packages/installer/icons/terminal.svg is excluded by !**/*.svg
  • packages/installer/nix-glow-black.png is excluded by !**/*.png
📒 Files selected for processing (14)
  • flake.nix (2 hunks)
  • npins/sources.json (1 hunks)
  • packages/default.nix (2 hunks)
  • packages/installer/awesome.nix (1 hunks)
  • packages/installer/awesomerc.lua (1 hunks)
  • packages/installer/base.nix (1 hunks)
  • packages/installer/default.nix (1 hunks)
  • packages/installer/lvm.nix (1 hunks)
  • packages/installer/motd.nix (1 hunks)
  • packages/installer/neovim.nix (1 hunks)
  • packages/installer/network.nix (1 hunks)
  • packages/installer/sddm.nix (1 hunks)
  • packages/installer/xterm.nix (1 hunks)
  • parts/auxiliary.nix (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: generate_matrix
  • GitHub Check: check_flake
🔇 Additional comments (20)
packages/installer/sddm.nix (1)

1-9: SDDM configuration looks good for an installer environment.

The configuration properly sets up SDDM with auto-login for the "nixos" user, which is appropriate for an installer image where you want to avoid authentication barriers.

packages/installer/neovim.nix (1)

1-9: Neovim configuration is properly structured.

The configuration correctly sets Neovim as the default editor through the EDITOR environment variable and adds it to the system packages. The package reference looks correct.

packages/installer/network.nix (1)

1-8: Network configuration is properly set up.

The configuration enables NetworkManager and correctly sets up the nm-applet to start with the graphical session.

packages/installer/lvm.nix (1)

1-9: LVM configuration is appropriate for an installer.

The configuration enables necessary LVM features (thin provisioning, VDO, and dmeventd) which are useful for an installer that might need to handle various disk configurations.

packages/installer/default.nix (1)

1-22: Well-structured NixOS configuration

The installer module is well-organized with a clean structure. The module imports all necessary configurations and passes the required specialArgs to child modules.

packages/installer/xterm.nix (1)

1-14: Clean XTerm configuration with appropriate defaults

The XTerm configuration provides reasonable defaults with good readability choices (dark background, light foreground, and a monospace font at a readable size). Using systemd tmpfiles for configuration distribution is an elegant approach.

parts/auxiliary.nix (1)

32-32: Good addition of lua-language-server

Adding lua-language-server is appropriate given the integration of Awesome window manager (which uses Lua for configuration). This will provide a better development experience when working with Awesome configuration files.

packages/installer/base.nix (2)

12-15: Good ISO configuration choices

The configuration provides appropriate customization for the ISO image with a custom edition name and efficient compression settings. The zstd compression at level 10 offers a good balance between compression ratio and decompression speed.


17-19: Helpful workaround for VMware guest issues

Good use of lib.mkForce to disable VMware guest tools that were causing issues. The comment explaining the rationale is helpful for future maintenance.

npins/sources.json (1)

3-14: Good addition of the Awesome window manager pin.

The new entry for "awesome" follows the established pattern in the file with all necessary components:

  • Properly references the GitHub repository and owner
  • Uses a specific full SHA revision for reproducibility
  • Includes a complete URL to the tarball
  • Contains a hash for integrity verification
packages/default.nix (4)

2-4: Appropriate function signature update.

Adding the npins parameter to the function signature is necessary to access the pin definitions, which is consistent with how this is being used later in the file.


34-43: Properly structured installer-iso package definition.

The installer-iso package is correctly defined, calling the installer module with appropriate inherited values. The deep attribute path to the isoImage is a standard pattern for NixOS ISO builds.


50-50: Good inheritance of the awesome package.

Inheriting the awesome package for Linux systems makes sense given the nature of the window manager.


21-30:

❓ Verification inconclusive

Well-structured awesome package override.

The overrideAttrs for the awesome package correctly uses the pinned version and source. The postPatch script properly handles the shebang patching for the test file.

Note that you're setting patches = [], which could potentially remove important patches from the original package. Was this intentional?


🏁 Script executed:

#!/bin/bash
# Check if the original awesome package has any patches
nix-instantiate --eval -E '(import <nixpkgs> {}).awesome.patches'

Length of output: 173


Verify Empty Patches List in Awesome Package Override

The override for the awesome package is well-structured and correctly uses the pinned version and source. However, setting patches = [] may unintentionally remove any patches that the original package defines. Our initial automated check (using nix-instantiate) did not yield the expected output due to the command being unavailable, so it's unclear whether the original package actually applies any patches.

  • File: packages/default.nix (lines 21–30)
  • Concern: Verify if clearing patches (i.e., setting patches = []) is intentional, or if any necessary patches from the original awesome package should be preserved.

Please manually verify the behavior regarding patches to ensure no critical updates are lost.

packages/installer/motd.nix (1)

25-36: Well-configured systemd user service for MOTD display.

The service is properly set up to:

  • Start with the graphical session
  • Display the MOTD using zenity for a graphical dialog
  • Restart on failure
  • Run as a simple service type
packages/installer/awesome.nix (4)

7-14: Clean configuration generation with proper substitutions.

The rc_lua generation uses substitute to properly inject paths to wallpaper and icons into the configuration file. This approach keeps the configuration template clean while allowing for dynamic path insertion.


16-23: Well-structured menu entries with essential installer options.

The menu provides a good selection of essential tools for an installation environment:

  • NixOS Manual for help
  • GParted for disk partitioning
  • System management options (reboot, power off)

Each entry includes an appropriate icon for visual identification.


38-41: Proper window manager configuration.

The awesome window manager is correctly enabled and configured to use the custom package defined above.


43-46: Clean approach to user configuration with tmpfiles.

Using systemd's tmpfiles to create symlinks in the user's config directory is a clean, declarative approach that:

  • Avoids modifying the user's home directory directly
  • Ensures configuration is always up-to-date with the system definition
  • Follows the principle of reproducibility
packages/installer/awesomerc.lua (1)

64-65:

❓ Verification inconclusive

Verify that menu_entries is available at runtime.
This snippet dynamically requires "menu_entries", but it's unclear where this file is located or how it's included in the Lua path.


🏁 Script executed:

#!/bin/bash
# Description: Search for a file named "menu_entries.lua" or "menu_entries" to ensure it exists.
fd -e lua -e '' 'menu_entries' --exec ls -l {}

Length of output: 48


Action Required: Confirm the Runtime Availability of menu_entries

The shell script did not return any matches for a file named menu_entries.lua or similar. This leaves open two possibilities:

  • The menu_entries module is generated dynamically at runtime (or during the build process) and may not appear in the source repository.
  • The file may be missing from the repository and consequently unavailable at runtime.

Next Steps:

  • Manual Verification: Ensure that the environment where this code runs correctly generates or includes the menu_entries module.
  • Clarification in Documentation: If the module is dynamically generated, document the process or dependencies required so that future developers understand how menu_entries becomes available.

Please validate the availability of this module in your runtime or build process.

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