mirror of
https://github.com/zephrynis/nix-flake.git
synced 2026-02-18 20:21:53 +00:00
- Create flake.nix to define NixOS configurations for PC and Laptop - Add README.md with setup instructions and layout overview - Implement common NixOS settings in modules/common.nix - Configure Home Manager for user-specific settings in home/users/user/home.nix - Set up hardware configurations for both PC and Laptop - Enable Home Manager integration in host configurations - Introduce Zen Browser package definition
2.1 KiB
2.1 KiB
Nix flake for PC and Laptop
This flake provides two NixOS hosts (pc and laptop) with shared modules and Home Manager.
Layout
flake.nix— Flake inputs/outputs, twonixosConfigurations(pc, laptop)modules/common.nix— Common NixOS settings for both hostshosts/pc— PC host config + itshardware-configuration.nixhosts/laptop— Laptop host config + itshardware-configuration.nixhome/users/user/home.nix— Home Manager configuration for the user
Quick start
- Update variables:
- In
flake.nix, setuser = "<your-username>". - Rename
home/users/user/tohome/users/<your-username>/and edithome.nixaccordingly. - In each host's
configuration.nix, the Home Manager import uses${user}so it will follow automatically once the flake variable is set. - Set
networking.hostNameper host if you want different names.
- Generate real hardware configs on each device:
On each machine, clone this repo and inside that host folder run:
sudo nixos-generate-config --show-hardware-config > hosts/<host>/hardware-configuration.nix
Replace the placeholder UUIDs and modules in the template with the generated content.
- Switch configuration on the machine:
From the repo root on the machine you are configuring:
sudo nixos-rebuild switch --flake .#pc
# or
sudo nixos-rebuild switch --flake .#laptop
If building from another machine for a remote target, add --target-host and optionally --use-remote-sudo.
- Home Manager only (optional):
Home Manager is integrated as a NixOS module. If you want to apply only HM changes after login:
home-manager switch --flake .#<username>@<host>
- Format the repo (optional):
nix fmt
Notes
- This flake targets x86_64-linux only. If you need ARM support, you'll need to add an aarch64 system and review the inputs.
- Update
system.stateVersionandhome.stateVersiononly when you deliberately accept new defaults. - To pin a newer NixOS release, change inputs
nixpkgsandhome-managerto the latest stable branch and review release notes.