Hello,
how can I install NixOS from running Ubuntu using /nix/store from the NixOS live iso image?
I have prepared the $target partition – fdisk, cryptsetup, btrfs, mounted volumes and system directories, generated configuration.nix, copied /nix/store from the iso image,…
I can even chroot to bash, but…
How to continue to install NixOS from nix/store, please?
See current installation steps bellow.
Expected steps to do: generate root file system, generate uki kernel+initrd (dracut) with kernel parameters for crypt open and mount btrfs root volume, sign it, copy kernel to EFI partition, create user hans (in wheel/sudo group), set password for hans, reboot with (current) systemd-boot, “install packages”,…
Thank you in advance,
Hans
# Update + Prerequisites
# Download Graphical ISO image from https://nixos.org/download/.
sudo -i
apt update
apt upgrade
apt install cryptsetup btrfs-progs vim #nix
# Partitioning
lsblk -f
device=/dev/nvme0n1
fdisk $device
# …
# Parameters
partition=${device}p7
efi_partition=${device}p1
luks_label=F4TB_CryptLinux_32GB
btrfs_label=F4TB_NixOS_32GB
crypt_name=crypt_nixos
mapper=/dev/mapper/$crypt_name
target=/mnt/p7
iso=/home/hans/Downloads/nixos-graphical-25.11.10134.26ef669cffa9-x86_64-linux.iso
iso_dir=/mnt/iso
# File systems
cryptsetup luksFormat -v --label $luks_label $partition
cryptsetup open $partition $crypt_name
mkfs.btrfs -L $btrfs_label $mapper
mkdir -p $target
mount $mapper $target
btrfs subvolume create $target/@ $target/@home $target/@var $target/@snapshots $target/@nix
umount $target
# https://forums.unraid.net/bug-reports/prereleases/consider-using-compress-force-instead-of-compress-for-btrfs-compression-r2326/
# https://docs.google.com/spreadsheets/d/1x9-3OQF4ev1fOCrYuYWt1QmxYRmPilw_nLik5H_2_qA
mount $mapper -odefaults,noatime,compress=zstd:6,discard=async,subvol=@ $target
cd $target
mkdir -p nix var home .snapshots boot/efi
mount $mapper -odefaults,noatime,compress=zstd:6,discard=async,subvol=@nix nix
mount $mapper -odefaults,noatime,compress=zstd:6,discard=async,subvol=@var var
mount $mapper -odefaults,noatime,compress=zstd:6,discard=async,subvol=@home home
mount $mapper -odefaults,noatime,compress=zstd:6,discard=async,subvol=@snapshots .snapshots
mount $efi_partition boot/efi
lsblk -f $partition
findmnt -R $target
# Installation
mkdir -p $iso_dir
mount -o ro,loop $iso $iso_dir
mkdir -p proc sys dev run etc
unsquashfs -d nix/store $iso_dir/nix-store.squashfs '*'
mount --bind /proc proc
mount --rbind /sys sys
mount --make-rslave sys
mount --rbind /dev dev
mount --make-rslave dev
#mount --bind /run run
mount -t tmpfs tmpfs run
export NIX_CONFIG="experimental-features = nix-command flakes"
find nix/store/*-nixos-generate-config -name nixos-generate-config
ls -l `!!`
nix/store/31y7hr6q3y32hf6d1ka1qizgbc3pg1dc-nixos-generate-config/bin/nixos-generate-config
nixos-generate-config --root .
#writing /mnt/p7/etc/nixos/hardware-configuration.nix...
#writing /mnt/p7/etc/nixos/configuration.nix...
#For more hardware-specific settings, see https://github.com/NixOS/nixos-hardware.
ls -l etc/nixos
vi -o etc/nixos/{,hardware-}configurationconfiguration.nix
cp /etc/{resolv.conf,hostname} etc
find nix/store/*-bash-interactive* -name bash
chroot . nix/store/nilkcchyj1l9ix3ww4p1fby7v00dwkpc-bash-interactive-5.3p3/bin/bash
bash-5.3# ls
bash: ls: command not found