-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (96 loc) · 3.55 KB
/
install-x86_64-grub.yml
File metadata and controls
117 lines (96 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# 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"