-
Set a Password for the NixOS User
To enable
scp
and other remote utilities, set a password for the NixOS user:passwd
-
Identify Disk Name and Update Configuration
Use
lsblk
to identify your disk's name:lsblk
Example output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS nvme0n1 259:0 0 1,8T 0 disk
Note your disk name at
/dev/<NAME>
. -
Copy the Disko Configuration File
Transfer the Disko configuration file to the target NixOS machine using
scp
:scp disko-config.nix nixos@nixos:/tmp/disko-config.nix
-
Run Disko to Create the Partition Table
Use Disko to set up the partitions as specified in
disko-config.nix
:sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko-config.nix
-
Generate NixOS Configuration Without Filesystems
Create a base NixOS configuration without filesystem definitions:
sudo nixos-generate-config --no-filesystems --root /mnt
-
Move Configuration Files to the Target Directory
Transfer system and Disko configuration files to the appropriate directory:
sudo mv /tmp/disk-config.nix /mnt/etc/nixos
-
Copy base configuration file
Transfer the base configuration file to the target NixOS machine using
scp
:The config just imports the generated hardware-configuration and disko.
_: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix" ./disko-config.nix ]; boot.loader.systemdboot.enable = true; boot.loader.efi.canTouchEfiVariables = true; }
scp hosts/linux/base-configuration.nix nixos@nixos:/tmp/configuration.nix sudo mv /tmp/configuration.nix /mnt/etc/nixos/configuration.nix
-
Install NixOS and Reboot
Proceed with the NixOS installation and reboot:
sudo nixos-install reboot
Important
You will be asked to set a password for the root user. Make sure to remember it, as you will need it later.
-
Login after Boot
After rebooting, log in with the following credentials:
- Username:
root
- Password:
<flokkq-is-cool>
- Username:
-
Install Git
Temporarily install Git through Nix:
nix-shell -p git
-
Clone the Configuration Repository
Clone the configuration repository to your home directory:
cd /etc/nixos && git clone https://github.com/Flokkq/nixos.git
Generate yourself a nice Username
chmod +x hostname.sh && ./hostname.sh
Make sure to move
hardware-configuration.nix
anddisko-config.nix
tohosts/linux/<your_username>
-
Add an Entry to the Hosts Array in
flake.nix
Open
flake.nix
and add a new entry to thehosts
array using the existing template as a guide:hosts = [ { name = "template"; monitors = [ { name = "eDP-1"; dimensions = "1920x1080"; position = "auto"; scale = 1; framerate = 74.97; transform = 0; primary = true; # must be set for onne external monitor internal = false; # iff it is a laptop display } ]; system = "linux"; } ];
Leave
monitors
empty initially. Define values forname
,system
(choose"darwin"
or"linux"
) -
Rebuild the System
Rebuild the system with the following command (this may take some time):
sudo NIXPKGS_ALLOW_UNFREE=1 nixos-rebuild switch --impure --flake /etc/nixos/#<hostname>
Replace
<hostname>
with the name specified inflake.nix
. -
Configure Monitors
After rebuilding, configure monitor settings:
- Use
hyprctl monitors all
to view connected monitors and their details. - Update the
monitors
array inflake.nix
with the correct configuration, settingprimary
andinternal
totrue
for your main display.
- Use
-
Rebuild NixOS Configuration for Updated Monitor Settings
Run the rebuild command to apply monitor configurations:
rebuildnix
For Darwin (macOS), the installation process is simpler and handled through nix-darwin
. Detailed steps can be found in the official nix-darwin documentation.
After following these steps make sure to add your machine to the configuration.
Open flake.nix
and add a new entry to the hosts
array using the existing template as a guide:
hosts = [
{
name = "template";
monitors = [];
system = "linux";
}
];
Leave monitors
empty. Define values for name
, system
(choose "darwin"
or "linux"
)