Skip to content

Commit

Permalink
boop is boopstrapped
Browse files Browse the repository at this point in the history
  • Loading branch information
ifd3f committed Mar 27, 2024
1 parent 8b3c9b1 commit f382050
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 59 deletions.
2 changes: 1 addition & 1 deletion machines/boop/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `xn--vp9h` (pronounced 🤓)
# boop

another server for applications and compute and stuff
20 changes: 11 additions & 9 deletions machines/boop/boot.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
inputs:
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
with lib;
let constants = import ./constants.nix;
in {
boot.loader = {
efi.canTouchEfiVariables = true;
efi = {
efiSysMountPoint = "/boot";
canTouchEfiVariables = true;
};

grub = {
enable = true;
devices = [ "nodev" ];
efiSupport = true;
useOSProber = true;
# splashImage = ./nerd-emoji.jpg;
};
};
Expand All @@ -23,17 +25,17 @@ in {

# because we want to be able to decrypt host keys over SSH
boot.initrd.network = {
udhcpc = {
enable = true;
extraArgs = [ "-i" constants.mgmt_if ];
};
enable = true;
udhcpc.enable = true;
postCommands = ''
ip addr
'';
ssh = {
enable = true;
port = 2222;
hostKeys = [ ./initrd/ssh_host_rsa_key ./initrd/ssh_host_ed25519_key ];
hostKeys = [
(pkgs.writeText "ssh_host_rsa_key" (builtins.readFile ./initrd/ssh_host_rsa_key))
(pkgs.writeText "ssh_host_ed25519_key" (builtins.readFile ./initrd/ssh_host_ed25519_key))
];
authorizedKeys = inputs.self.lib.sshKeyDatabase.users.astrid;
};
};
Expand Down
28 changes: 28 additions & 0 deletions machines/boop/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -euxo pipefail

mkdisks() {
zpool create rpool mirror /dev/disk/by-id/nvme-eui.6479a7869ad03b89 /dev/disk/by-id/nvme-eui.6479a7869ad04a16
zfs create -o encryption=on -o keylocation=prompt -o keyformat=passphrase rpool/enc
zfs set mountpoint=none rpool
zfs set compression=on rpool
for pool in rpool/enc/var rpool/enc/etc rpool/enc/tmp rpool/enc/home rpool/nix; do
zfs create -o mountpoint=legacy $pool
done
zfs list
}

mountdisks() {
mount -t tmpfs -o size=256M,mode=755 rootfs /mnt
mount -t zfs -o x-mount.mkdir rpool/enc/tmp /mnt/tmp
mount -t zfs -o x-mount.mkdir rpool/nix /mnt/nix
mount -t zfs -o x-mount.mkdir rpool/enc/var /mnt/var
mount -t zfs -o x-mount.mkdir rpool/enc/etc /mnt/etc
mount -t zfs -o x-mount.mkdir rpool/enc/home /mnt/home
mount -o x-mount.mkdir /dev/disk/by-uuid/D30E-26C7 /mnt/boot
}

runinstall() {
nixos-install --no-channel-copy --option substituters "" $@
}
30 changes: 30 additions & 0 deletions machines/boop/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ with lib; {

astral = {
users.alia.enable = true;
users.astrid.enable = true;
virt = {
docker.enable = true;
libvirt.enable = true;
Expand Down Expand Up @@ -44,4 +45,33 @@ with lib; {
recommendedOptimisation = true;
recommendedGzipSettings = true;
};

# tmp for debug
services.getty.autologinUser = "root";

virtualisation.vmVariant = {
# Autologin as root because we testin here
services.getty.autologinUser = "root";

networking.interfaces.eth0.useDHCP = true;
networking.interfaces.eno0.useDHCP = mkForce false;

virtualisation = {
graphics = false;
diskSize = 8192;

forwardPorts = [
{
from = "host";
host.port = 2222;
guest.port = 22;
}
{
from = "host";
guest.port = 80;
host.port = 8080;
}
];
};
};
}
1 change: 1 addition & 0 deletions machines/boop/fs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
fileSystems."/" = {
device = "rootfs";
fsType = "tmpfs";
options = [ "defaults" "size=256M" "mode=755" ];
};

fileSystems."/tmp" = {
Expand Down
11 changes: 5 additions & 6 deletions machines/boop/initrd/ssh_host_ed25519_key
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABDTxRDob4
4LmmUE//yPbisVAAAAGAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIGAtSF+Kx47/zdUe
5/3L06RbULmoEFnJi9Jmd9q2ia5NAAAAoGCPHycy7g8DVslaHrXmhhfwotFW6VnSUn7/pE
3UQAt5KMxNfWLWXsDNpxQBVJ6sYPesrirlWg2hcAPvt2fFGPLe4tbICKqje2F8cS5enTfr
S/GcusyaC4/xmD0udZEpFLqx1dvP3VxickCuml28NItZqspwny25htcahpOaE/RZeHLHXZ
CKzEGBnBHBdwgQUwIwXA67m2IyvjxO3ZmHLoo=
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBC8L/jKIgAm/NtHruBIuj9ByVY0++i31NhVKwVpbKwAAAAAJhKZyfpSmcn
6QAAAAtzc2gtZWQyNTUxOQAAACBC8L/jKIgAm/NtHruBIuj9ByVY0++i31NhVKwVpbKwAA
AAAECfEM7PiuGMsWCwdnUVINnm5C5dhmpt6XtjD1d7OJKIqkLwv+MoiACb820eu4Ei6P0H
JVjT76LfU2FUrBWlsrAAAAAADmFzdHJpZEBjaHVuZ3VzAQIDBAUGBw==
-----END OPENSSH PRIVATE KEY-----
2 changes: 1 addition & 1 deletion machines/boop/initrd/ssh_host_ed25519_key.pub
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGAtSF+Kx47/zdUe5/3L06RbULmoEFnJi9Jmd9q2ia5N
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIELwv+MoiACb820eu4Ei6P0HJVjT76LfU2FUrBWlsrAA
73 changes: 36 additions & 37 deletions machines/boop/initrd/ssh_host_rsa_key
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b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wQCHOI+I5PI8OuhlGjj25XZ6JieJh8kwSl9d8W/4NCBlV9tFc9ncnGqlf5b/TpW8VSWha5
22+iBtLsyvVYstFo/yhaw/kRnh6t0vh0L3fM0AE4gnHV/YSpr84fOMvlABpXTKv/re2Es+
r+GqpC9QY3MlSHaNLG00eQoKGNwj4Z968FPo2nMR7wL/NyHl1XPPnfxvpm/HgDFpRQWdQQ
3XO+fWO2j7BavNEz6L8pWLgwxXSWOJuftyEHZGyAr6nOnjJ6oAAADBAOKTj9F8a1lm+Ea1
3sy7j5piiLY5ynhl1slxSGLJWRCUCNcMNoBqz6qQ1OL3FznMLo6+6KaF8x4TSsHMSQqAj3
7YKqJZSH+YUzfsVPPNgb/sOhy7gF7zRB5aPOFexelGLsygfPpFj9lpQvG25PWGci4EZ42A
Bp4V8016hz23HJfSfLBvT3WIJgRutztLUMYicrH/85S2pbX/dFCZHROzxSKHPlCjn4VMH/
cHjMBAXCOvuNJJcIc6ldOQ5SOS2WNkowAAAMEAv96+NfPU90yQ4tFYdC4p1ozLVjEZu7V6
FsH7AoP9CSWMtuj9WnOd5k8xSbiqMhUaCAc+TzsSbt7BhnnaPIswSTDPdVoYm0ImSkKRwj
qrdZNsnIw/UVvtxFrT4DBN63TCfb7hyPZ1z0ew2cr9+4MyLVocNOBJd7zrAOv8Cdcd5Qni
I23G2Efi9crmmcGpL4GddMyZyMQzSaCoZ6oVrFBLJMIr5XcP9gj/iOygef54YdplN2xA03
MBr9MMet+oEOoHAAAADmFzdHJpZEBjaHVuZ3VzAQIDBA==
-----END OPENSSH PRIVATE KEY-----
2 changes: 1 addition & 1 deletion machines/boop/initrd/ssh_host_rsa_key.pub
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCQmmjQlsrm8RTETENBLzSfJfcxdeTATowvNSbmnHrEot0QX89KrbmfdeKTSP1ppp5CgSHU0ASNLYla23xz0HsszZFC3c8JJIH3/BS34f/FLIvfsT2Rn4x2OyWr0xw24n8fqBEca7nt3eyeKfj3oiq+pJ6xSMyuiGmywlYubGrFJJe6L/Yey1qgAlGXEOtbe9x3fO1tb1/6cOlYqSM8LeVbO+oWAxiWsH68f8HsUo/equ6qk59LgiO5MegYZBHH+IyowW2cgQxe4RA5Hm+hdW7ibxvBAH0uu0NHUw3yi020jZaAKHNWLnapgRM2uaBHFtoGVVPsHALdZ0FVuzLWQOJIN2uE6PRdnwaZtnTxU33IRdcos/bbZbTuq+5sFNhF3rZdwjd3ndAg/BdsDzXVGjppEHWdEd5cZ7zfbr7p7zmK7pO0lRRHg6FtSkWqCIakG3gQ+SAGdlVoRQIAmZ3AzwtJCUrQRMLE+dg/oLgI16XtQWOlbOXEgCoUNj84iz1CMVE=
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCp0TydSJbMGN9+fgusiYOI4ZV9hruIVR9dUe75xrUlUuK6y4kmww4W8Ssgr3E2OrkNqz821rpN4pKI+uvfMSw7xxtwtvFA78TYr6ylqJM3XL8vA0EG/R/Lba+j2eygcW7khQJ1WnYqemZ4BbjETggG4RqnvnVeNwuG83yjqXzFOKe4IknowsQ9PJpXEz7xLLZ54LT3dop6K0JCYnEJz6ZnVXWbt8O7eyJPhgDVFZBwb1iWIMDCCF0nl2R2qaI4U4LEO0thGzHm2tYzVcsvQ8oh/kGvzPj21hv60Ej274F6foolSNCjIHvXUpJpG/7U7iorUTqWmCNcH/vzrJYZBmzEr1mhjPHd6nijshzlx0YBDqCSAcQsQ8ptXfM1363hkfQKVDOId1OKd0WTLuS3cuC1qx+8988MGc30rPaEqF1HI2kjKx5gszs6W/LhBb+XFPQzmip5xybfyEiK9BpVzOzJ3a18KP9Od5sBvrI/bzTLg/2tJagfCWxxzM1b9w3kvnU=
8 changes: 4 additions & 4 deletions nix/nixos-modules/roles/server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ with lib; {
boot.kernelPackages = pkgs.linuxKernel.packages.linux_hardened;

# Enable SSH in initrd for debugging
boot.initrd.network.ssh = {
enable = true;
authorizedKeys = [ inputs.self.lib.sshKeyDatabase.users.astrid ];
};
# boot.initrd.network.ssh = {
# enable = true;
# authorizedKeys = [ inputs.self.lib.sshKeyDatabase.users.astrid ];
# };

astral = {
acme.enable = true;
Expand Down

0 comments on commit f382050

Please sign in to comment.