forked from M-Labs/defenestrate
auto-install
This commit is contained in:
parent
f4f75834a9
commit
58f63e5d66
37
README
37
README
|
@ -1,33 +1,10 @@
|
||||||
Installation commands for NUC:
|
* Enter BIOS, disable secure boot, enable UEFI PXE network boot
|
||||||
|
* sudo auto-install
|
||||||
parted /dev/nvme0n1 -- mklabel gpt
|
* sudo reboot
|
||||||
parted /dev/nvme0n1 -- mkpart primary 512MiB 100%
|
* Run memtest86
|
||||||
parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 512MiB
|
* Copy device database to ~/artiq
|
||||||
parted /dev/nvme0n1 -- set 2 esp on
|
* Set timezone
|
||||||
mkfs.ext4 -L nixos /dev/nvme0n1p1
|
* Comment out openssh.authorizedKeys.keys
|
||||||
mkfs.fat -F 32 -n boot /dev/nvme0n1p2
|
|
||||||
mount /dev/disk/by-label/nixos /mnt
|
|
||||||
mkdir -p /mnt/boot
|
|
||||||
mount /dev/disk/by-label/boot /mnt/boot
|
|
||||||
nixos-generate-config --root /mnt
|
|
||||||
# copy configuration to /mnt/etc/nixos
|
|
||||||
nix-env -iA nixos.git
|
|
||||||
# work around https://github.com/NixOS/nixpkgs/issues/209819
|
|
||||||
rm /etc/nix/nix.conf
|
|
||||||
cp /etc/static/nix/nix.conf /etc/nix/nix.conf
|
|
||||||
vi /etc/nix/nix.conf
|
|
||||||
# set:
|
|
||||||
substituters = https://nixbld.m-labs.hk?priority=10 https://cache.nixos.org/
|
|
||||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc=
|
|
||||||
#
|
|
||||||
nixos-install --no-root-password --flake /mnt/etc/nixos#artiq
|
|
||||||
reboot
|
|
||||||
# run memtest86
|
|
||||||
|
|
||||||
After installation is finalized:
|
|
||||||
* copy device database to ~/artiq
|
|
||||||
* set timezone
|
|
||||||
* comment out openssh.authorizedKeys.keys
|
|
||||||
* sudo nixos-rebuild boot
|
* sudo nixos-rebuild boot
|
||||||
* sudo nix-collect-garbage -d
|
* sudo nix-collect-garbage -d
|
||||||
* history clear
|
* history clear
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
let
|
||||||
|
pkgs = import <nixpkgs> {};
|
||||||
|
|
||||||
|
# copied from nixpkgs/nixos/release.nix. Unfortunately, this isn't exported.
|
||||||
|
makeNetboot = { modules, system, ... }:
|
||||||
|
let
|
||||||
|
configEvaled = import <nixpkgs/nixos/lib/eval-config.nix> {
|
||||||
|
inherit system modules;
|
||||||
|
};
|
||||||
|
build = configEvaled.config.system.build;
|
||||||
|
kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.linux-kernel.target;
|
||||||
|
in
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "netboot";
|
||||||
|
paths = [
|
||||||
|
build.netbootRamdisk
|
||||||
|
build.kernel
|
||||||
|
build.netbootIpxeScript
|
||||||
|
];
|
||||||
|
postBuild = ''
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
echo "file ${kernelTarget} ${build.kernel}/${kernelTarget}" >> $out/nix-support/hydra-build-products
|
||||||
|
echo "file initrd ${build.netbootRamdisk}/initrd" >> $out/nix-support/hydra-build-products
|
||||||
|
echo "file ipxe ${build.netbootIpxeScript}/netboot.ipxe" >> $out/nix-support/hydra-build-products
|
||||||
|
'';
|
||||||
|
preferLocalBuild = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
autoInstall = pkgs.writeShellScriptBin "auto-install"
|
||||||
|
''
|
||||||
|
set -e
|
||||||
|
parted /dev/nvme0n1 -- mklabel gpt
|
||||||
|
parted /dev/nvme0n1 -- mkpart primary 512MiB 100%
|
||||||
|
parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 512MiB
|
||||||
|
parted /dev/nvme0n1 -- set 2 esp on
|
||||||
|
mkfs.ext4 -L nixos /dev/nvme0n1p1
|
||||||
|
mkfs.fat -F 32 -n boot /dev/nvme0n1p2
|
||||||
|
mount /dev/disk/by-label/nixos /mnt
|
||||||
|
mkdir -p /mnt/boot
|
||||||
|
mount /dev/disk/by-label/boot /mnt/boot
|
||||||
|
nixos-generate-config --root /mnt
|
||||||
|
cp ${./final}/* /mnt/etc/nixos
|
||||||
|
nixos-install --no-root-password --flake /mnt/etc/nixos#artiq
|
||||||
|
'';
|
||||||
|
|
||||||
|
customModule = {
|
||||||
|
environment.systemPackages = [ autoInstall pkgs.git ];
|
||||||
|
nix.settings.trusted-public-keys = ["nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="];
|
||||||
|
nix.settings.substituters = ["https://nixbld.m-labs.hk?priority=10"];
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
makeNetboot {
|
||||||
|
modules = [
|
||||||
|
<nixpkgs/nixos/modules/installer/netboot/netboot-minimal.nix>
|
||||||
|
customModule
|
||||||
|
];
|
||||||
|
system = "x86_64-linux";
|
||||||
|
}
|
Loading…
Reference in New Issue