209 lines
5.6 KiB
Markdown
209 lines
5.6 KiB
Markdown
|
|
# Install Nanuqsaurus On An Empty Partition (No Full-Disk Wipe)
|
|||
|
|
|
|||
|
|
This repo’s `nanuqsaurus-btrfs` “fresh install” path uses `disko` to create a brand new GPT layout (EFI + Btrfs) and therefore **wipes the whole disk**. If you want to install onto an **existing empty partition** while keeping other partitions intact, use the “wrapper flake” approach and a manual mount + `nixos-install`.
|
|||
|
|
|
|||
|
|
These steps are meant to be run from a **NixOS installer ISO** on the target laptop.
|
|||
|
|
|
|||
|
|
## 0) Preconditions
|
|||
|
|
|
|||
|
|
- Boot the installer in **UEFI mode** (this profile enables `systemd-boot` + EFI).
|
|||
|
|
- You have working network connectivity (WiFi instructions below).
|
|||
|
|
- You have:
|
|||
|
|
- an existing **empty root partition** you will format (example: `/dev/nvme0n1p6`)
|
|||
|
|
- an existing **EFI System Partition** (vfat) you will mount at `/boot` (example: `/dev/nvme0n1p1`)
|
|||
|
|
|
|||
|
|
Confirm UEFI:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
test -d /sys/firmware/efi/efivars && echo "UEFI booted" || echo "NOT UEFI booted"
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 0.5) Connect To WiFi (Installer)
|
|||
|
|
|
|||
|
|
Most NixOS installer ISOs run NetworkManager. The easiest flow is `nmtui`.
|
|||
|
|
|
|||
|
|
1) Bring up the text UI and connect:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
sudo -i
|
|||
|
|
nmtui
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
In `nmtui`:
|
|||
|
|
|
|||
|
|
- Select `Activate a connection`
|
|||
|
|
- Pick your WiFi SSID
|
|||
|
|
- Enter the password
|
|||
|
|
- Exit
|
|||
|
|
|
|||
|
|
2) Verify you have connectivity:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ping -c 1 1.1.1.1
|
|||
|
|
ping -c 1 example.com
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
If `nmtui` is unavailable, try:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
nmcli dev status
|
|||
|
|
nmcli dev wifi list
|
|||
|
|
nmcli dev wifi connect "YOUR_SSID" password "YOUR_PASSWORD"
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 1) Identify Your Partitions
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
lsblk -f
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Pick stable paths if available (`/dev/disk/by-id/...`). In the commands below, set:
|
|||
|
|
|
|||
|
|
- `ROOT_PART` = the empty partition to become `/`
|
|||
|
|
- `EFI_PART` = the EFI System Partition (vfat) to become `/boot`
|
|||
|
|
|
|||
|
|
Example:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ROOT_PART=/dev/nvme0n1p6
|
|||
|
|
EFI_PART=/dev/nvme0n1p1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 2) Format The Root Partition
|
|||
|
|
|
|||
|
|
Warning: this destroys data on `ROOT_PART`.
|
|||
|
|
|
|||
|
|
Recommended (Btrfs with subvolumes similar to this repo’s intended layout):
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
mkfs.btrfs -f -L nixos "$ROOT_PART"
|
|||
|
|
|
|||
|
|
mount "$ROOT_PART" /mnt
|
|||
|
|
btrfs subvolume create /mnt/root
|
|||
|
|
btrfs subvolume create /mnt/home
|
|||
|
|
btrfs subvolume create /mnt/nix
|
|||
|
|
umount /mnt
|
|||
|
|
|
|||
|
|
mount -o subvol=root,compress=zstd "$ROOT_PART" /mnt
|
|||
|
|
mkdir -p /mnt/home /mnt/nix
|
|||
|
|
mount -o subvol=home,compress=zstd "$ROOT_PART" /mnt/home
|
|||
|
|
mount -o subvol=nix,compress=zstd "$ROOT_PART" /mnt/nix
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Alternative (ext4):
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
mkfs.ext4 -F -L nixos "$ROOT_PART"
|
|||
|
|
mount "$ROOT_PART" /mnt
|
|||
|
|
mkdir -p /mnt/nix
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 3) Mount EFI At `/boot`
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
mkdir -p /mnt/boot
|
|||
|
|
mount "$EFI_PART" /mnt/boot
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 4) Generate Hardware Config
|
|||
|
|
|
|||
|
|
Important: do this **after** mounting `/boot`, so the EFI mount gets captured.
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
nixos-generate-config --root /mnt
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
This creates:
|
|||
|
|
|
|||
|
|
- `/mnt/etc/nixos/hardware-configuration.nix`
|
|||
|
|
- `/mnt/etc/nixos/configuration.nix` (we will not use this directly)
|
|||
|
|
|
|||
|
|
## 5) Create A Wrapper Flake In `/etc/nixos`
|
|||
|
|
|
|||
|
|
This repo’s `nanuqsaurus` profile defines an `admin` user and also tends to lock `root` by default. To avoid surprises, set your own password hashes in the wrapper flake using `lib.mkForce`.
|
|||
|
|
|
|||
|
|
If you have a Lenovo ThinkPad X13 (Intel), you can also import the `nixos-hardware` module for it in this wrapper flake.
|
|||
|
|
|
|||
|
|
1) Generate SHA-512 password hashes:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
nix --experimental-features "nix-command flakes" \
|
|||
|
|
shell nixpkgs#mkpasswd -c mkpasswd -- -m sha-512
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Run it twice if you want to set both `admin` and `root`.
|
|||
|
|
|
|||
|
|
2) Create `/mnt/etc/nixos/flake.nix`:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
nano /mnt/etc/nixos/flake.nix
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Paste and edit:
|
|||
|
|
|
|||
|
|
```nix
|
|||
|
|
{
|
|||
|
|
description = "Local wrapper for the nanuqsaurus profile";
|
|||
|
|
|
|||
|
|
inputs = {
|
|||
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
|
|||
|
|
nanuqsaurus = {
|
|||
|
|
url = "git+https://codeberg.org/randogoth/nanuqsaurus.git";
|
|||
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|||
|
|
};
|
|||
|
|
# Optional hardware profiles (recommended on laptops)
|
|||
|
|
nixos-hardware = {
|
|||
|
|
url = "github:NixOS/nixos-hardware";
|
|||
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|||
|
|
};
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
outputs = inputs@{ nixpkgs, nanuqsaurus, nixos-hardware, ... }: {
|
|||
|
|
nixosConfigurations.nanuqsaurus = nixpkgs.lib.nixosSystem {
|
|||
|
|
system = "x86_64-linux";
|
|||
|
|
specialArgs = { inherit inputs; };
|
|||
|
|
modules = [
|
|||
|
|
./hardware-configuration.nix
|
|||
|
|
# Optional: ThinkPad X13 (Intel) profile (path: lenovo/thinkpad/x13/intel)
|
|||
|
|
# Remove or replace if you have different hardware.
|
|||
|
|
nixos-hardware.nixosModules.lenovo-thinkpad-x13-intel
|
|||
|
|
nanuqsaurus.nixosModules.nanuqsaurus
|
|||
|
|
({ lib, ... }: {
|
|||
|
|
networking.hostName = "nanuqsaurus";
|
|||
|
|
system.stateVersion = "25.11";
|
|||
|
|
|
|||
|
|
nanuqsaurus.admin.username = "admin";
|
|||
|
|
users.users.admin.hashedPassword = lib.mkForce "PUT_ADMIN_SHA512_HASH_HERE";
|
|||
|
|
|
|||
|
|
# Recommended so you can recover easily:
|
|||
|
|
users.users.root.hashedPassword = lib.mkForce "PUT_ROOT_SHA512_HASH_HERE";
|
|||
|
|
|
|||
|
|
# Optional: require sudo password (this repo defaults to passwordless sudo)
|
|||
|
|
security.sudo.wheelNeedsPassword = lib.mkForce true;
|
|||
|
|
})
|
|||
|
|
];
|
|||
|
|
};
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 6) Install NixOS
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
NIX_CONFIG="experimental-features = nix-command flakes" \
|
|||
|
|
nixos-install --root /mnt --flake /mnt/etc/nixos#nanuqsaurus
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 7) Reboot
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
reboot
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
If your firmware shows multiple boot options, select the systemd-boot entry for the disk containing the EFI partition.
|
|||
|
|
|
|||
|
|
## Notes
|
|||
|
|
|
|||
|
|
- Secure Boot: this repo’s installer ISO expects Secure Boot off at boot; after installation you can enable Secure Boot using Lanzaboote (see `docs/secure-boot.md`).
|
|||
|
|
- If you actually want to wipe an entire disk and let this repo handle partitioning, use `disko-install` with `#nanuqsaurus-btrfs` (see `README.md` and `docs/install-help.txt`).
|