- home-manager:
- home.nix
- etc...
- flake.lock
- flake.nix
- nixos:
- configuration.nix
- hardware-configuration.nix (this can/should be generated and copied over for specific server)
- networking.nix
https://github.com/elitak/nixos-infect
Check distro/version for compatibility
-
Setup ssh access with root
-
> export doNetConf=y
-
> curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-22.11 bash -x
note: ignore warnings about script not supported being run -
Clone nix-config git repo in root home
-
Copy
hardware-configuration.nix
andnetworking.nix
to target nix-config for consistency note: you may need to generatehardware-configuration.nix
again with thenixos-generate-config
command. delete the old file if necessary. -
Build or rebuild after making changes
$ sudo nixos-rebuild switch --flake .#{hostname}
note: unsure why network-addresses-eth0.service may fail. just run it again -
Copy nix-config to new user home directory
$ cp -r nix-config /home/daibar/
-
Set password for newly created users from root or sudo
$ passwd {username}
-
Log into target user (i.e. daibar)
$ su - daibar
-
Follow Home Manager instructions
- Navigate to
~/nix-config
- Update
flake.nix
andhome-manager/home.nix
as directed in comments - Run the following commands while in nixos-config folder:
$ home-manager --flake . switch
or$ home-manager switch --flake .#{username}@{hostname}
note: use -b backup flag as necessary - Set zsh as default shell:
$ chsh -s $(which zsh)
Always commit your changes before using switch. If you have uncommitted changes they won't be found during install!