-
-
Notifications
You must be signed in to change notification settings - Fork 53
feat(nix): Support nixos #3640
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
base: main
Are you sure you want to change the base?
feat(nix): Support nixos #3640
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @yutkat, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
As Gemini, your code-assist companion, I've reviewed this pull request. The primary intent of this PR, based on the title and the significant changes, is to introduce and integrate Nix and Home Manager into the dotfiles management. This involves migrating configuration from previous methods (like Zinit for program installation and manual file management) to a declarative approach using Nix flakes. The changes enable support for NixOS as a primary platform and streamline configuration management for other Linux distributions via Home Manager standalone.
Highlights
- Nix/Home Manager Integration: The dotfiles have been refactored to use Nix flakes (
flake.nix
) and Home Manager (home.nix
,home-manager/
). This shifts the configuration and package management to a declarative system, making it easier to manage dependencies and configurations across different machines. - NixOS Support: Adds specific configurations for NixOS systems (
nixos/
) including system-level settings, bootloader, networking, fonts, input methods, and display management (using greetd/regreet for Hyprland). - Standalone Home Manager Support: Includes configurations (
home-manager/
) designed for using Home Manager on non-NixOS distributions (like Arch, Ubuntu, Fedora) to manage user-level packages and dotfiles. - Revised Installation Script: The
install.sh
script has been completely rewritten to handle the installation of Nix (multi-user or single-user), enable flakes, install Home Manager standalone, and provide instructions for applying the configurations usingnixos-rebuild switch
orhome-manager switch
. It also includes an uninstall option. - Zsh Configuration Changes: Significant changes were made to the Zsh configuration (
.config/zsh/
) to comment out Zinit management for many programs (like eza, ripgrep, bat, trashy, neovim, gh) presumably to rely on Nix/Home Manager for their installation. Conditional sourcing based on command existence was added for some plugin configurations. - Application Configuration Updates: Various application configurations have been updated, including changes to Chrome flags, CopyQ settings, Hyprland environment variables and window rules, Vivaldi configuration, and Walker entries/icons.
- Neovim Plugin Updates: The
lazy-lock.json
file was updated, indicating updates to several Neovim plugins. Additionally,mason-conform.nvim
was added, andnixfmt
was configured as a formatter for Nix files.
Changelog
Click here to see the changelog
- .config/chrome-flags.conf
- Added
--disable-features=WaylandTextInputV3
flag.
- Added
- .config/copyq/copyq.conf
- Changed
disable_tray
fromfalse
totrue
. - Added
item_data_threshold=1024
. - Added
navigation_style=0
. - Added
update_clipboard_owner_delay_ms=-1
. - Added
num_sel_fg=
.
- Changed
- .config/environment.d/50-i3-sway.conf
- Replaced previous environment variable definitions with a path likely managed by Home Manager.
- .config/fcitx5/conf/mozc.conf
- Added
InputState="Follow Global Configuration"
.
- Added
- .config/gtk-4.0/settings.ini
- Added a new file defining GTK 4 settings (theme, icons, font, cursor, sounds, dark theme preference, recent files).
- .config/hypr/config.d/env.conf
- Added
env = FCITX_DATA_HOME,$HOME/.config/fcitx5/data
.
- Added
- .config/hypr/config.d/startup.conf
- Changed
windowrulev2
towindowrule
for CopyQ rules. - Updated CopyQ class matching regex from
(com.github.hluk.copyq)
to.*copyq
. - Added a 'Logout' entry to the Walker configuration (
hyprctl dispatch exit
).
- Changed
- .config/nvim/lazy-lock.json
- Updated commit hashes for numerous Neovim plugins (e.g.,
copilot.lua
,debugprint.nvim
,gitsigns.nvim
,mason.nvim
,mason-lspconfig.nvim
,neoconf.nvim
,neogit
,nui.nvim
,nvim-dap
,nvim-dap-virtual-text
,nvim-lint
,nvim-lspconfig
,nvim-scrollbar
,nvim-surround
,nvim-treesitter
,nvim-treesitter-context
,nvim-treesitter-textobjects
,nvim-various-textobjs
,octo.nvim
,one-small-step-for-vimkind
,rustaceanvim
,translate.nvim
). - Added
mason-conform.nvim
plugin entry.
- Updated commit hashes for numerous Neovim plugins (e.g.,
- .config/nvim/lua/rc/pluginconfig/conform.lua
- Added
nix = { "nixfmt" }
toformatters_by_ft
.
- Added
- .config/nvim/lua/rc/pluginlist.lua
- Added
mason-conform.nvim
plugin definition.
- Added
- .config/vivaldi-stable.conf
- Replaced previous Vivaldi flags with a single line referencing
chromium-flags.conf
.
- Replaced previous Vivaldi flags with a single line referencing
- .config/walker/config.toml
- Updated icons for Shutdown, Reboot, and Lock Screen entries to use symbolic versions.
- Added a 'Logout' entry with
hyprctl dispatch exit
.
- .config/zsh/rc/alias.zsh
- Removed the
-x
flag from thedisk-usage
alias.
- Removed the
- .config/zsh/rc/function.zsh
- Removed the explicit
lspconfig.setup_handlers
block from themason-lspconfig.nvim
configuration.
- Removed the explicit
- .config/zsh/rc/myplugins/command_config.zsh/command_config.zsh
- Removed an empty line.
- .config/zsh/rc/pluginconfig/fzf_atload.zsh
- Added conditional sourcing for fzf key-bindings and completion scripts.
- .config/zsh/rc/pluginconfig/trashy_atload.zsh
- Added
alias rm='trash put'
.
- Added
- .config/zsh/rc/pluginlist.zsh
- Commented out Zinit configurations for numerous programs (zoxide, fzf, eza, ripgrep, fd, bat, trashy, tealdeer, procs, delta, mmv, zsh, git, neovim, wezterm, translate-shell, direnv, mise, gh, wakatime), indicating a shift to Nix/Home Manager for these.
- Changed fzf loading to use
is-snippet
. - Added conditional sourcing for some plugin configurations (
eza_atload.zsh
,bat_atload.zsh
,trashy_atload.zsh
,neovim_atload.zsh
,gh_atload.zsh
) if the corresponding command exists.
- .gitignore
- Added
/.config/nvim/lazy-lock.json
to the ignored list. - Added Nix/Nixos/home-manager directories and
system-etc
to the list of paths not to ignore (prefixed with!
).
- Added
- .zshenv
- Added
$HOME/.config/zsh/scripts/(N-/)
to thepath
array. - Added
export GPG_TTY=$(tty)
.
- Added
- README.md
- Updated Tokei badge URL.
- Revised 'Supported OS' section to highlight NixOS and differentiate GUI/CLI support.
- Rewrote 'Install' section with detailed instructions for NixOS and other OS using Home Manager standalone, including flake configuration editing and using
nixos-rebuild switch
orhome-manager switch
. - Updated 'Temporary Install' instructions to use a Docker container and the new
install.sh --single
option. - Removed i3 and sway from the list of optional GUI environments.
- flake.nix
- Added a new file defining the Nix flake structure.
- Specifies inputs:
nixpkgs
,home-manager
,neovim-nightly-overlay
. - Defines outputs for
nixosConfigurations
andhomeConfigurations
. - Includes host definitions (
lemp10
,X1C10
,test
,system-test
) with system type, host-specific config path, GUI/System enablement flags, and default username. - Provides functions (
mkNixosSystem
,mkHomeManagerConfiguration
) to build configurations based on host attributes. - Allows overriding the username via the
NIX_USERNAME
environment variable.
- home-manager/cli.nix
- Added a new file defining Home Manager configuration for CLI packages (git, zsh, neovim, gcc, pythonEnv, nodejs, deno, zip, unzip, eza, wakatime-cli, mise, direnv, translate-shell, gh, ripgrep, delta, tldr, trashy, bat, fd, procs, mmv-go, fzf, sqlite).
- Adds the python environment bin directory to the session path.
- Enables neovim (using nightly overlay), zsh, and gpg programs.
- Configures the gpg-agent service with ssh support and pinentry-curses.
- home-manager/gui.nix
- Added a new file defining Home Manager configuration for GUI packages (vivaldi, wezterm, nordzy-cursor-theme, waybar, walker, wl-clipboard-rs, hyprpaper, dunst, libnotify, copyq, hypridle, hyprlock, grim, slurp, pyprland, brightnessctl, adwaita-icon-theme, arc-theme, comixcursors, gnome-themes-extra, papirus-icon-theme).
- Includes a Nixpkgs overlay to configure Vivaldi with command line arguments read from
.config/vivaldi-stable.conf
. - Enables Hyprland with UWSM and Xwayland.
- Disables fontconfig.
- home.nix
- Added a new file defining the main Home Manager configuration.
- Imports
cli.nix
and conditionally importsgui.nix
based on theenableGui
special argument. - Sets
home.username
,home.homeDirectory
, andhome.stateVersion
. - Uses a helper function (
mkLink
) to create symlinks for files in.config
(excluding systemd and environment.d) and.config/environment.d
. - Creates symlinks for
.xinitrc
,.xprofile
, and.zshenv
. - Creates executable symlinks for
x-terminal-emulator
(wezterm) andx-www-browser
(vivaldi), conditionally linking to the Nix store path if GUI is enabled, otherwise linking to/usr/bin
. - Adds an activation script to set the global git config include path.
- Sets the
LD_LIBRARY_PATH
session variable to include sqlite. - Enables
nixpkgs.config.allowUnfree
andprograms.home-manager
.
- install.sh
- Completely rewrote the script to manage Nix and Home Manager installation and setup.
- Added options
--single
for single-user Nix installation and--uninstall
for complete cleanup. - Includes functions for detecting OS, checking root, showing help, removing dead symlinks, uninstalling Nix (multi-user/single-user), cleaning user files, installing Nix (multi-user/single-user), enabling flakes, installing Home Manager standalone, and setting up for NixOS or standalone systems.
- Provides clear logging with colors.
- Replaced previous
dotsinstaller.sh
andarch-extra-setup.sh
calls with Nix/Home Manager logic.
- nixos/configuration.nix
- Added a new file defining the main NixOS system configuration.
- Imports
hardware-configuration.nix
. - Configures systemd-boot, networking (NetworkManager), timezone, locale/input method (fcitx5 with mozc/gtk), fonts, Xserver (disables GDM/Gnome, enables greetd/regreet), Hyprland with UWSM, XKB layout, locate, printing (CUPS), sound (Pipewire), sudo.
- Defines the user account with necessary groups and zsh as the shell.
- Enables
programs.zsh
andnixpkgs.config.allowUnfree
. - Adds
nix-index
to system packages. - Sets
system.stateVersion
and enablesnix-command
andflakes
experimental features.
- nixos/hardware-configuration.nix
- Added a new file (likely generated) defining hardware-specific settings for NixOS.
- nixos/hosts/lemp10/configuration.nix
- Added a new host-specific NixOS configuration file for 'lemp10'.
- Imports its hardware configuration.
- Adds udev rules for custom key mappings on a System76 Lemur.
- nixos/hosts/lemp10/hardware-configuration.nix
- Added a new host-specific hardware configuration file (likely generated) for 'lemp10', defining filesystems and LUKS.
- system-etc/udev/README.md
- Added a new file explaining the commands needed to apply udev rules after copying.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
From scattered files,
A flake takes hold,
Declarative dreams,
In stories told,
Your system configured, brave and bold.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request aims to enhance the system's functionality by incorporating NixOS configurations and improving various aspects of the user environment. The changes span multiple configuration files, shell scripts, and documentation. While the changes appear to be well-structured, there are several areas that could benefit from further review and refinement.
Summary of Findings
- Tray Disablement: The tray is disabled in
copyq.conf
without explanation. - Environment File Replacement: The
50-i3-sway.conf
file is replaced with a single-line path, requiring verification. - Window Rule Syntax Change: The
windowrulev2
syntax is replaced withwindowrule
instartup.conf
, requiring compatibility checks. - Nixfmt Availability: The
conform.lua
file addsnixfmt
without checking its availability. - Disk Usage Alias: The
-x
option is removed from thedisk-usage
alias, requiring clarification. - FZF Plugin Loading: The
fzf
plugin is loaded as a snippet, requiring functionality checks. - Conditional Plugin Sourcing: The
eza
andgh
plugins are conditionally sourced, requiring initialization checks. - Gitignore Lockfile: The
lazy-lock.json
file is added to.gitignore
, requiring justification. - ZSH Path Inclusion: A new path is added to the ZSH path variable, requiring security considerations.
- GPG TTY Export: The
GPG_TTY
variable is exported, requiring environmental awareness. - Nix Flake Check: The
nix flake check
command is run without the--no-build
flag.
Merge Readiness
The pull request introduces significant changes to the system configuration and installation process. While the changes appear to be well-structured, there are several areas that require further clarification and refinement. It is recommended that the pull request not be merged until the issues identified in the review comments are addressed. I am unable to approve this pull request, and users should have others review and approve this code before merging.
@@ -20,7 +20,7 @@ command_history_size=100 | |||
confirm_exit=true | |||
copy_clipboard=false | |||
copy_selection=false | |||
disable_tray=false | |||
disable_tray=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
windowrule=float,class:.*copyq | ||
windowrule=size 50% 50%,class:.*copyq | ||
windowrule=center,class:.*copyq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -38,5 +38,6 @@ require("conform").setup({ | |||
}, | |||
formatters_by_ft = { | |||
markdown = { "my_markdown" }, | |||
nix = { "nixfmt" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -166,7 +166,7 @@ function alias-improve() { | |||
} | |||
|
|||
alias hdu='ncdu --color dark -rr -x --exclude .git --exclude node_modules' | |||
alias disk-usage='sudo ncdu --color dark -rr -x --exclude .git --exclude node_modules /' | |||
alias disk-usage='sudo ncdu --color dark -rr --exclude .git --exclude node_modules /' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src"shell-integration.zsh" \ | ||
atload"source $ZHOMEDIR/rc/pluginconfig/fzf_atload.zsh" \ | ||
for @junegunn/fzf | ||
is-snippet for "$ZHOMEDIR/rc/pluginconfig/fzf_atload.zsh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -24,6 +24,7 @@ typeset -xT SUDO_PATH sudo_path | |||
path=( | |||
$HOME/.local/share/zsh/zinit/polaris/bin(N-/) | |||
$HOME/bin(N-/) | |||
$HOME/.config/zsh/scripts/(N-/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -113,3 +114,4 @@ | |||
helpline=white,black | |||
roottext=lightgrey,black | |||
' | |||
export GPG_TTY=$(tty) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./install.sh --single | ||
exec bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [[ $EUID -eq 0 ]]; then | ||
if [[ "$SINGLE_USER_MODE" == "true" ]]; then | ||
log_error "Single-user mode should not be run as root" | ||
else | ||
log_error "This script should not be run as root" | ||
fi | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script checks if it's running as root and exits if it is. However, it displays an error message indicating that it shouldn't be run as root. It should be clarified whether running as root is completely disallowed or if there are specific scenarios where it might be necessary (e.g., for certain installation steps).
|
||
# Check if flake.nix is valid | ||
log_info "Validating flake configuration..." | ||
if nix flake check --no-build 2>/dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aa6bf75
to
a461e1f
Compare
No description provided.