Note
Before proceeding with the installation, review the following files to customise your setup:
hosts/Default/variables.nix: Contains host-specific variables.hosts/Default/host-packages.nix: Lists installed packages for the host.hosts/Default/default.nix: Defines imports for the host configuration.
You can install this configuration either on a running system or from the NixOS live installer. The minimal ISO is recommended and can be downloaded from the official NixOS website.
-
Clone the Repository:
git clone https://github.com/Sly-Harvey/NixOS.git ~/NixOS -
Navigate to the Directory:
cd ~/NixOS
-
Run the Installation Script:
./install.sh
The
install.shandrebuildscripts automates the setup process, including hosts, username, and applying the configuration. It also automatically generates the hardware-configuration.nix file based on your system's detected hardware, eliminating the need to manually generate hardware-configuration.nix.
To switch to an existing host or create a new one:
-
Automatic: Run the installation script again to select or create another host:
./install.sh
-
Manual:
-
Copy the
hosts/Defaultdirectory to a new directory (e.g.,hosts/NewHost). -
Modify
hosts/NewHost/variables.nixto suit your needs. -
Update
hosts/NewHost/host-packages.nixto include desired packages. -
Add the new host to
flake.nixin thenixosConfigurationssection, for example:nixosConfigurations = { Default = mkHost "Default"; NewHost = mkHost "NewHost"; };
-
Rebuild the system using method 3 or 4 below (specifying the new host name). Once rebuilt, any of the rebuilding methods can be used, as the host name will be implicitly recognised.
-
To apply changes or rebuild the system, use one of the following methods:
-
Using a Keyboard Shortcut: Press
Super + Uto trigger a rebuild. -
Using the
rebuildScript in a Terminal:rebuild
-
Using nixos-rebuild:
sudo nixos-rebuild switch --flake ~/NixOS#<HOST>
-
Using
nhTool:nh os switch --hostname <HOST>
Replace <HOST> with the name of your host (e.g., Default).
-
List available generations in the terminal:
list-gens
-
Rollback to a specific generation (replace
Nwith the generation number):rollback N
To view configured keybindings:
- Press
Super + ?to display the keybinding overview. - Press
Super + Ctrl + Ksame as above.
This configuration includes pre-configured development shells for various programming languages and frameworks, making it easy to start new projects or work in isolated environments.
To create a new project from a template:
nix flake init -t ~/NixOS#<TEMPLATE_NAME>To create a new project directory with a template:
nix flake new -t ~/NixOS#<TEMPLATE_NAME> <PROJECT_NAME>Replace <TEMPLATE_NAME> with the name of a template defined in dev-shells/default.nix (e.g., python, node, etc.).
If direnv is configured, navigate to the project directory, and the shell will activate automatically. Otherwise, manually enter the shell:
cd <PROJECT_NAME>
nix develop| Credit | Reason |
|---|---|
| Hyprland-Dots | Script and Waybar templates |
| HyDE | Some more useful scripts |
| rofi | Rofi launcher templates |
| dev-templates | Development templates |
| Vimjoyer | Short, simple, concise guides and info |






