Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mlyxshi committed Dec 27, 2024
1 parent 1f8c811 commit 1c28868
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} 'curl -LO https://github.com/mlyxshi/flake/releases/download/$(uname -m)/initrd'
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} 'curl -LO https://github.com/mlyxshi/flake/releases/download/$(uname -m)/kernel'
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} 'chmod +x ./kexec'
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} "./kexec --kexec-syscall-auto --load ./kernel --initrd=./initrd --append=\"systemd.set_credential_binary=github-private-key:${{ secrets.SSH_PRIVATE_KEY_BASE64 }} systemd.hostname=systemd-initrd systemd.mount-extra=tmpfs:/:tmpfs:mode=0755\""
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} "./kexec --kexec-syscall-auto --load ./kernel --initrd=./initrd --append=\"systemd.set_credential_binary=github-private-key:${{ secrets.SSH_PRIVATE_KEY_BASE64 }} systemd.hostname=systemd-initrd ip=dhcp systemd.mount-extra=tmpfs:/:tmpfs:mode=0755\""

- name: Run kexec
# If server doesn't reply, ServerAliveInterval option will kill ssh, and emit error
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kexec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} 'curl -LO https://github.com/mlyxshi/flake/releases/download/$(uname -m)/initrd'
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} 'curl -LO https://github.com/mlyxshi/flake/releases/download/$(uname -m)/kernel'
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} 'chmod +x ./kexec'
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} "./kexec --kexec-syscall-auto --load ./kernel --initrd=./initrd --append=\"systemd.set_credential_binary=github-private-key:${{ secrets.SSH_PRIVATE_KEY_BASE64 }} systemd.hostname=systemd-initrd systemd.mount-extra=tmpfs:/:tmpfs:mode=0755\""
- run: $SSH ${{ inputs.user }}@${{ inputs.ip }} "./kexec --kexec-syscall-auto --load ./kernel --initrd=./initrd --append=\"systemd.set_credential_binary=github-private-key:${{ secrets.SSH_PRIVATE_KEY_BASE64 }} systemd.hostname=systemd-initrd ip=dhcp systemd.mount-extra=tmpfs:/:tmpfs:mode=0755\""
- name: Run kexec
# If server doesn't reply, ServerAliveInterval option will kill ssh, and emit error
# This is the normal behaviour as expected, so let github workflow treat error as success
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
/opt/homebrew/bin/qemu-system-aarch64 -machine virt -cpu cortex-a57 -accel hvf -nographic -m 8G \
-kernel ${self.nixosConfigurations.kexec-aarch64.config.system.build.kernel}/Image \
-initrd ${self.nixosConfigurations.kexec-aarch64.config.system.build.initialRamdisk}/initrd \
-append "systemd.journald.forward_to_console systemd.set_credential_binary=github-private-key:''$(cat /Users/dominic/.ssh/test-base64) systemd.hostname=systemd-initrd systemd.mount-extra=tmpfs:/:tmpfs:mode=0755" \
-append "systemd.journald.forward_to_console systemd.set_credential_binary=github-private-key:''$(cat /Users/dominic/.ssh/test-base64) systemd.hostname=systemd-initrd ip=dhcp systemd.mount-extra=tmpfs:/:tmpfs:mode=0755" \
-device "virtio-net-pci,netdev=net0" -netdev "user,id=net0,hostfwd=tcp::8022-:22" \
-device "virtio-scsi-pci,id=scsi0" -drive "file=disk.img,if=none,format=qcow2,id=drive0" -device "scsi-hd,drive=drive0,bus=scsi0.0" \
-bios $(ls /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-aarch64-code.fd)
Expand Down
4 changes: 2 additions & 2 deletions host/darwin/M4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

networking.hostName = "M4";

# ssh-ng://m1 aarch64-linux /Users/dominic/.ssh/id_ed25519 8 1 big-parallel,kvm,nixos-test - c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUVJKzd0Y3RDZTJOR3BYdWZNem9MWG5GeThpOGpFVkgzdEdWRmpMY2NOU0YK
nix.distributedBuilds = true;
nix.buildMachines = [{
protocol = "ssh-ng";
hostName = "m1";
system = "aarch64-linux";
sshKey = "/Users/dominic/.ssh/id_ed25519";
maxJobs = 8;
supportedFeatures = [
"big-parallel"
Expand All @@ -21,7 +21,7 @@
}];
nix.settings.builders-use-substitutes = true;

programs.ssh.knownHosts."m1".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEI+7tctCe2NGpXufMzoLXnFy8i8jEVH3tGVFjLccNSF";
programs.ssh.knownHosts.m1.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEI+7tctCe2NGpXufMzoLXnFy8i8jEVH3tGVFjLccNSF";
programs.ssh.extraConfig = ''
Host m1
HostName 192.168.1.190
Expand Down
2 changes: 2 additions & 0 deletions kexec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ systemd.hostname=systemd-initrd
# FSTYPE: tmpfs
# OPTIONS: mode=0755
systemd.mount-extra=tmpfs:/:tmpfs:mode=0755"
# https://github.com/poettering/systemd/blob/9b436342705ece5304b3f6cbefd739f6da0ae742/test/test-network-generator-conversion.sh#L113
ip=dhcp
```

# Usage
Expand Down
4 changes: 0 additions & 4 deletions kexec/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

boot.initrd.systemd.enable = true;
boot.initrd.systemd.network.enable = true;
boot.initrd.systemd.network.networks.ethernet-default-dhcp = {
matchConfig = { Name = [ "en*" "eth*" ]; };
networkConfig = { DHCP = "yes"; };
};

boot.initrd.network.ssh.enable = true;
boot.initrd.systemd.services.sshd.preStart = lib.mkForce "/bin/chmod 0600 /etc/ssh/ssh_host_ed25519_key";
Expand Down

0 comments on commit 1c28868

Please sign in to comment.