mirror of
https://github.com/zephrynis/nix-flake.git
synced 2026-02-18 20:21:53 +00:00
33d7cc4cbf450b229efff27717b38bca0446ce3a
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.
Description
Languages
TypeScript
84.7%
Nix
9.1%
SCSS
5.3%
CSS
0.5%
Shell
0.4%