Configuration files for my NixOS machines and home configurations.
- Clone this repo into the home directory of a NixOS-system and change into it.
- Run the following command when initially setting up the system:
sudo nixos-rebuild switch --flake .#<<machine>> - If there is a
justfiledefined by the machine's user, it will be automatically created in thenix-configdirectory. It leveragesjustto define simple commands for doing NixOS housekeeping, like switching configurations and updating the system.
- Clone this repo into the home directory of a NixOS-system and change into it.
- Run the following command when initially setting up Home Manager:
nix run nixpkgs#home-manager -- switch --flake .#<<home config>> # --impure could be necessary - If there is a
justfiledefined by the user, it will be automatically created in thenix-configdirectory. It leveragesjustto define simple commands for doing Home Manager housekeeping, like switching configurations and updating the setup.
Utilities and helper functions.
Configurations and hardware configurations specific to the respective machine. Each machine config also contains the respective Home Manager user config, if defined.
NixOS modules.
Home Manger modules.
Home Manager configurations for a standalone user config.
Package overlays.
Note: The config sets a static IPv4 address and other network options. Check that the IP address is not already in used in your network. For step 4 you will need to use this IP address.
- Run a graphical NixOS-installer image (the permissions/authentication can be a problem on the minimal ISOs).
- Set a password for the
nixosuser viapasswd. - Run the following command from the root of this repository and use the just created password when promted.
Note: If there is already an existing
hardware-configuration.nix, you don't need the corresponding options.nix run github:nix-community/nixos-anywhere -- \ --flake .#orville \ --build-on-remote \ --generate-hardware-config \ nixos-generate-config \ machines/orville/hardware-configuration.nix \ --target-host nixos@<IP address of the remote host>
- The setup is complete. To apply changes in the future, run the following command.
NIX_SSHOPTS="-i /home/steve/.ssh/id_orville_ed25519" nixos-rebuild switch \ --flake .#orville \ --target-host steve@<IP address of the remote host> --sudo --ask-sudo-password
Note: The config sets a static IPv4 address and other network options. Check that the IP address is not already in used in your network. For step 4 you will need to use this IP address.
- Build the SD card image:
nix build .#packages.aarch64-linux.discovery-sdcard-image- You need to be capable of building for
aarch64-linux, either by- building on a native
aarch64-linuxhost, - building on a remote
aarch64-linuxmachine, or - by having
aarch64-linuxemulation enabled on your build machine, typically viaboot.binfmt.emulatedSystems = [ "aarch64-linux" ];
- building on a native
- The built image file will be
./result/sd-image/nixos-discovery-sdcard-aarch64-linux.img - It contains the whole final system and is not an installer. Because we can just flash the complete system image onto the SD card, there is no need for an installer.
- You need to be capable of building for
- Flash the image onto the SD card:
IMPORTANT:ddwill destroy your data! Triple check that you selected the right output device!!!
Select your target device being flashed vialsblk -f, then replace the desired device (e.g./dev/sdb) in the following command:This may take some minutes. Don't cancel the command!sudo dd if=./result/sd-image/nixos-discovery-sdcard-aarch64-linux.img of=/dev/null bs=4096 conv=fsync status=progress
- Insert the SD card into the device and boot.
- The setup is complete. To apply changes in the future, run the following command.
NIX_SSHOPTS="-i /home/steve/.ssh/id_discovery_ed25519" \ nixos-rebuild switch \ --flake .#discovery \ --target-host steve@<IP address of the remote host> --sudo --ask-sudo-password