From 613a76ac294a6e12df3b36beec19cf1c5760effe Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 27 Apr 2023 16:36:48 +0200 Subject: [PATCH] Add steps in install documentation --- doc/install.md | 62 ++++++++++++++++++++++++++++++++++++++++ xeon02/configuration.nix | 7 +++-- 2 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 doc/install.md diff --git a/doc/install.md b/doc/install.md new file mode 100644 index 0000000..05a6022 --- /dev/null +++ b/doc/install.md @@ -0,0 +1,62 @@ +# Installing NixOS in a new node + +This article shows the steps to install NixOS in a node following the +configuration of the repo. + +## Prepare the disk + +Create a main partition and label it `nixos` following [the manual][1]. + +[1]: https://nixos.org/manual/nixos/stable/index.html#sec-installation-manual-partitioning. + +``` +# disk=/dev/sdX +# parted $disk -- mklabel msdos +# parted $disk -- mkpart primary 1MB 100% +# parted $disk -- set 1 boot on +``` + +Then create an etx4 filesystem, labeled `nixos` where the system will be +installed. **Ensure that no other partition has the same label.** + +``` +# mkfs.ext4 -L nixos "${disk}1" +# mount ${disk}1 /mnt +# lsblk -f $disk +NAME FSTYPE LABEL UUID MOUNTPOINT +sdX +`-sdX1 ext4 nixos 10d73b75-809c-4fa3-b99d-4fab2f0d0d8e /mnt +``` + +## Prepare nix and nixos-install + +Mount the nix store from the xeon07 node in read-only /nix. + +``` +# mkdir /nix +# mount -o ro xeon07:/nix /nix +``` + +Get the nix binary and nixos-install tool from xeon07: + +``` +# ssh xeon07 'readlink -f $(which nix)' +/nix/store/0sxbaj71c4c4n43qhdxm31f56gjalksw-nix-2.13.3/bin/nix +# ssh xeon07 'readlink -f $(which nixos-install)' +/nix/store/9yq8ps06ysr2pfiwiij39ny56yk3pdcs-nixos-install/bin/nixos-install +``` + +And add them to the PATH: + +``` +# export PATH=$PATH:/nix/store/0sxbaj71c4c4n43qhdxm31f56gjalksw-nix-2.13.3/bin +# export PATH=$PATH:/nix/store/9yq8ps06ysr2pfiwiij39ny56yk3pdcs-nixos-install/bin/ +# nix --version +nix (Nix) 2.13.3 +``` + +## Build the nixos kexec image + +``` +# nix build .#nixosConfigurations.xeon02.config.system.build.kexecTree -v +``` diff --git a/xeon02/configuration.nix b/xeon02/configuration.nix index 83d4114..06d88ff 100644 --- a/xeon02/configuration.nix +++ b/xeon02/configuration.nix @@ -1,12 +1,15 @@ { config, pkgs, modulesPath, lib, ... }: { - imports = [ ../common/main.nix (modulesPath + "/installer/netboot/netboot-minimal.nix") ]; + imports = [ + #(modulesPath + "/installer/netboot/netboot-minimal.nix") + ../common/main.nix + ]; # Select the this using the ID to avoid mismatches boot.loader.grub.device = "/dev/disk/by-id/wwn-0x55cd2e414d535629"; #programs.ssh.forwardX11 = false; - programs.ssh.setXAuthLocation = lib.mkForce true; + #programs.ssh.setXAuthLocation = lib.mkForce true; networking = { hostName = "xeon02";