Skip to content

Deduplicate the NixOS config and drop no-op Home Manager settings - #26

Merged
user3301 merged 1 commit into
masterfrom
simplify-nixos-config
Oct 10, 2026
Merged

user3301 merged 1 commit into
masterfrom
simplify-nixos-config

Conversation

@user3301

@user3301 user3301 commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

Makes the NixOS config more concise without adding or removing any package or feature.

Restructure, with no change to the built systems. The nixos-wsl, nixos-wsl-bootstrap and nixos-native toplevel derivations are byte-identical to master.

  • New systems/common.nix holds the settings both hosts had copied: Nix settings, garbage collection, unfree, timezone, the user, zsh and base packages.
  • mkSystem adds common.nix, the overlays and Home Manager for every host. The username is defined once as user in flake.nix.
  • The home host files no longer set home.username/home.homeDirectory, which Home Manager's NixOS module already sets. home/modules/common.nix imports the shared modules.
  • config.lib.dotfiles.link "<path>" replaces the 11 long mkOutOfStoreSymlink paths.
  • Removed lines that restate defaults (services.openssh.enable = false, i18n.defaultLocale, Docker enableOnBoot), empty placeholders, and the mislabeled "Windows SSH agent" comment.

Fixes, which change only Home Manager outputs.

  • Removed home.sessionVariables (EDITOR, VISUAL, DOTFILES). zsh never read them, and bash already sets all three itself.
  • Replaced programs.yazi with pkgs.yazi. Its zsh integration and yy wrapper were no-ops with Home Manager's shell modules off.
  • Each package is now listed once:
    • neovim, git, wget and curl (and firefox on native) stay system packages only.
    • programs.gh and programs.gpg install gh and gnupg.
    • ripgrep, fd, gcc, nil and nixpkgs-fmt each live in one module.

AGENTS.md and the docs are updated to match, including a "list each package once" rule.

Deliberately unchanged

  • log-driver = "json-file": NixOS defaults Docker to journald, so this isn't redundant.
  • iptables = true: removing it would rewrite daemon.json and restart Docker.
  • The nixpkgs-fmt → nixfmt swap, the Home Manager CLI and standalone docker-compose: changing them would change the package set.
  • The Makefile.
  • Native's defaultSession rename warning: fixing it needs native's services section re-nested to satisfy statix.

Verification

  • Restructure: the toplevel .drv paths are identical to master for all three configs.
  • Fixes, against a master baseline:
    • System packages are unchanged.
    • The combined system and Home Manager package set is unchanged, apart from the regenerated hm-session-vars.sh, which only loses the three exports.
    • Home files, systemd user variables, Docker settings and groups are unchanged.
  • Switching from the running system (master's build):
    • The only unit that changes is home-manager-user3301.service.
    • The per-user profile drops 14 commands (git and its helpers, nvim, curl/wcurl, wget). They stay on PATH via the system profile, with identical binaries.
    • Bash sessions that are open during the switch and already used those commands need hash -r. zsh falls back on its own.

Test plan

  • nix-quality, lua-format, zsh-syntax and bash-syntax checks pass
  • nixos-wsl and nixos-native evaluate. WSL has no warnings; native shows only the existing defaultSession rename warning.
  • nixos-wsl toplevel builds without activation
  • CI passes
  • make switch on WSL

🤖 Generated with Claude Code

Restructure without changing the built systems (the nixos-wsl,
nixos-wsl-bootstrap and nixos-native toplevel derivations are
byte-identical to master):

- Move settings shared by both hosts into systems/common.nix
- Let mkSystem add common.nix, the overlays and Home Manager for every
  host, and define the username once as `user` in flake.nix
- Drop home.username/homeDirectory (set by Home Manager's NixOS module)
  and import the shared home modules from home/modules/common.nix
- Replace the 11 mkOutOfStoreSymlink paths with config.lib.dotfiles.link
- Remove settings that restate defaults (openssh.enable = false,
  i18n.defaultLocale, Docker enableOnBoot), empty placeholders and the
  mislabeled "Windows SSH agent" comment

Fix settings that did nothing and packages listed twice; only Home
Manager outputs change:

- Remove home.sessionVariables: zsh never read them, and bash sets
  EDITOR, VISUAL and DOTFILES itself
- Replace programs.yazi with pkgs.yazi: its zsh integration and yy
  wrapper were no-ops with Home Manager's shell modules off
- Keep neovim, git, wget and curl (and firefox on native) as system
  packages only, let programs.gh and programs.gpg install gh and gnupg,
  and list ripgrep, fd, gcc, nil and nixpkgs-fmt once

The combined system and Home Manager package set is unchanged apart
from the regenerated hm-session-vars.sh. Docs and AGENTS.md are updated
to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The refactor consistently preserves host-specific behavior while centralizing shared settings and removing verified redundancies.

0 open findings

What changed in this PR

This PR centralizes shared NixOS configuration and removes redundant Home Manager settings without changing host functionality.

Changes:

  • Adds shared system and Home Manager module composition.
  • Centralizes username, overlays, and configuration-link helpers.
  • Deduplicates packages and updates documentation.
File Description
systems/​wsl/​configuration.nix Retains WSL-specific settings only.
systems/​native/​configuration.nix Retains native host settings only.
systems/​common.nix Adds shared NixOS configuration.
nvim/​.config/​nvim/​README.md Documents revised package ownership.
home/​nixos-wsl.nix Simplifies WSL Home Manager imports.
home/​nixos-native.nix Simplifies native Home Manager imports.
home/​modules/​wezterm.nix Uses the shared link helper.
home/​modules/​terminal.nix Simplifies Yazi and configuration links.
home/​modules/​shell.nix Uses the shared link helper.
home/​modules/​neovim.nix Removes duplicate packages.
home/​modules/​languages.nix Simplifies package syntax.
home/​modules/​git.nix Removes packages installed elsewhere.
home/​modules/​dev-tools.nix Consolidates development packages.
home/​modules/​common.nix Imports shared modules and defines link helper.
flake.nix Centralizes system construction and username.
docs/​README.nix.md Documents shared module locations.
docs/​QUICK_REFERENCE.md Updates configuration ownership references.
docs/​DEPLOYMENT.md Documents centralized username handling.
docs/​ARCHITECTURE.md Updates architecture and package ownership.
AGENTS.md Updates contributor rules and layout.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@user3301
user3301 merged commit c99ff68 into master Oct 10, 2026
2 checks passed
@user3301
user3301 deleted the simplify-nixos-config branch October 10, 2026 05: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.

2 participants