Install x86_64 BIOS Grub #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # For small memory server (512MB RAM) | |
| # kexec may perserve some memory from previous OS, reboot to grub will clear all memory | |
| name: "Install x86_64 BIOS Grub" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ip: | |
| description: 'Ip or Domain' | |
| type: string | |
| required: true | |
| flakeAttr: | |
| description: 'OS Config Hostname' | |
| type: string | |
| jobs: | |
| Grub: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: | | |
| mkdir -m 0755 ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| cat > ~/.ssh/config <<EOF | |
| Host installer | |
| HostName ${{ inputs.ip }} | |
| HostKeyAlias installer | |
| User root | |
| StrictHostKeyChecking no | |
| EOF | |
| - uses: actions/checkout@master | |
| - run: wget https://github.com/mlyxshi/flake/releases/download/x86_64/initrd | |
| - run: wget https://github.com/mlyxshi/flake/releases/download/x86_64/kernel | |
| - name: Set up WARP (For IPv6 only server) | |
| uses: ./.github/actions/setup-ipv6 | |
| if: contains(inputs.ip, ':') | |
| - run: | | |
| until ssh -o ConnectTimeout=10 installer | |
| do | |
| echo "Server Not Reachable, Waiting..." | |
| sleep 5 | |
| done | |
| - run: scp initrd kernel installer:/root/ | |
| - run: | | |
| ssh installer "cat > /boot/grub/custom.cfg" <<EOF | |
| menuentry "NixOS" --id NixOS { | |
| insmod ext2 | |
| search -f /etc/hostname --set root | |
| linux /root/kernel systemd.journald.forward_to_console root=fstab | |
| initrd /root/initrd | |
| } | |
| set default="NixOS" | |
| EOF | |
| - name: Reboot | |
| continue-on-error: true | |
| run: ssh installer reboot -f | |
| install: | |
| if: ${{ inputs.flakeAttr }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: | | |
| mkdir -m 0755 ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| cat > ~/.ssh/config <<EOF | |
| Host installer | |
| HostName ${{ inputs.ip }} | |
| HostKeyAlias installer | |
| User root | |
| StrictHostKeyChecking no | |
| EOF | |
| - uses: actions/checkout@master | |
| - uses: DeterminateSystems/nix-installer-action@main | |
| - run: | | |
| outPath=$(nix build --no-link --print-out-paths .#nixosConfigurations.${{ inputs.flakeAttr }}.config.system.build.toplevel) | |
| echo "outPath=$outPath" >> "$GITHUB_ENV" | |
| - name: Set up WARP (For IPv6 only server) | |
| uses: ./.github/actions/setup-ipv6 | |
| if: contains(inputs.ip, ':') | |
| - run: | | |
| until ssh -o ConnectTimeout=10 installer ls /etc/initrd-release | |
| do | |
| echo "Initramfs Environment Not Reachable, Waiting..." | |
| sleep 5 | |
| done | |
| - run: | | |
| DEVICE=$(nix eval --raw .#nixosConfigurations.${{ inputs.flakeAttr }}.config.boot.loader.limine.biosDevice) | |
| echo "DEVICE=$DEVICE" >> "$GITHUB_ENV" | |
| - name: Create and mount partitions for BIOS + GPT | |
| uses: ./.github/actions/bios-gpt | |
| # --substitute-on-destination | |
| - run: nix copy --to ssh://installer?remote-store=local?root=/mnt $outPath | |
| - run: ssh installer nix-env --store /mnt -p /mnt/nix/var/nix/profiles/system --set $outPath | |
| - run: ssh installer mkdir /mnt/{etc,tmp} | |
| - run: ssh installer touch /mnt/etc/NIXOS | |
| - run: ssh installer NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root /mnt -- /run/current-system/bin/switch-to-configuration boot | |
| - run: ssh installer reboot | |
| - run: curl "https://api.day.app/${{ secrets.BARK_KEY }}/NixOS%20Install%20Done/${{ inputs.flakeAttr }}?group=NixOS&icon=https://hydra.nixos.org/logo" |