diff --git a/.config/bash/module/Bootstrap.sh b/.config/bash/module/Bootstrap.sh index 907b7c0..ac9c06b 100644 --- a/.config/bash/module/Bootstrap.sh +++ b/.config/bash/module/Bootstrap.sh @@ -42,3 +42,40 @@ function bootstrap_flatpak() { _iterate_targets process ${targets[@]} } + +# Install nixos to specified drive. To be run from Live ISO. +# Usage: bootstrap_nixos [HOST] +function bootstrap_nixos() { + local target="${1}" + local host="${2}" + + if [[ "${target}" = "" ]]; then + help bootstrap_nixos + return 2 + fi + + # Create partitions. + parted -s "${target}" mktable gpt + parted -s "${target}" mkpart primary 0% 512MB + parted -s "${target}" mkpart primary 512MB 100% + + # Format. + mkfs.fat -F 32 "${target}1" + mkfs.ext4 -F "${target}2" + + # Mount. + mount "${target}2" /mnt + mkdir /mnt/boot + mount "${target}1" /mnt/boot + + # Generate config. + nixos-generate-config --root /mnt + + # Install. + cd /mnt + if [[ "${host}" = "" ]]; then + nixos-install + else + nixos-install --flake "${_nix_system_config}#${host}" + fi +} diff --git a/.config/linux/system/flake.nix b/.config/linux/system/flake.nix index 82b007b..cd0c61e 100644 --- a/.config/linux/system/flake.nix +++ b/.config/linux/system/flake.nix @@ -116,6 +116,7 @@ system = "x86_64-linux"; modules = [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" + "${nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix" { networking.wireless.enable = nixpkgs.lib.mkForce false; } ({ pkgs, ... }: { boot.kernelPackages = nixpkgs.lib.mkForce pkgs.linuxPackages; }) ./module/Gnome.nix