-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (86 loc) · 3.36 KB
/
install-x86_64-kexec.yml
File metadata and controls
107 lines (86 loc) · 3.36 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
name: "Install x86_64 BIOS Kexec"
on:
workflow_dispatch:
inputs:
ip:
description: 'Ip or Domain'
type: string
required: true
flakeAttr:
description: 'OS Config Hostname'
type: string
jobs:
kexec:
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: curl -LO https://github.com/mlyxshi/flake/releases/download/x86_64/kexec
- run: curl -LO https://github.com/mlyxshi/flake/releases/download/x86_64/initrd
- run: curl -LO 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 kexec initrd kernel installer:/root/
- run: ssh installer chmod +x kexec
- run: ssh installer ./kexec --load ./kernel --initrd=./initrd --append="root=fstab rd.systemd.break=pre-switch-root"
- name: Run kexec
continue-on-error: true
run: ssh installer systemctl kexec -i
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
- run: nix copy --substitute-on-destination --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"