2024-08-21 15:33:33 +02:00
|
|
|
# I hate this so much aaa
|
|
|
|
{
|
2024-11-29 20:42:04 +01:00
|
|
|
lib,
|
2024-08-21 15:33:33 +02:00
|
|
|
callPackage,
|
|
|
|
dockerTools,
|
|
|
|
openssh,
|
|
|
|
bash,
|
|
|
|
gnused,
|
|
|
|
util-linux,
|
2024-11-29 16:41:23 +01:00
|
|
|
qemu-user
|
2024-08-21 15:33:33 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
dockerTools.buildLayeredImage {
|
|
|
|
name = "build-worker-oci";
|
|
|
|
tag = "latest";
|
|
|
|
|
|
|
|
fromImage = callPackage ./source.nix {};
|
|
|
|
|
|
|
|
maxLayers = 110;
|
|
|
|
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
|
|
|
enableFakechroot = true;
|
|
|
|
|
2024-11-29 16:41:23 +01:00
|
|
|
contents = [ openssh util-linux bash gnused qemu-user ];
|
2024-08-21 15:33:33 +02:00
|
|
|
|
|
|
|
config.Cmd = [ "/entrypoint.sh" ];
|
|
|
|
|
2024-11-29 22:34:55 +01:00
|
|
|
fakeRootCommands = let
|
|
|
|
system-features = [
|
|
|
|
"benchmark"
|
|
|
|
"big-parallel"
|
|
|
|
"nixos-test"
|
|
|
|
"uid-range"
|
|
|
|
"gccarch-x86-64"
|
|
|
|
"gccarch-x86-64-v2"
|
|
|
|
"gccarch-x86-64-v3"
|
|
|
|
"gccarch-armv8-a"
|
|
|
|
"gccarch-armv8.1-a"
|
|
|
|
"gccarch-armv8.2-a"
|
|
|
|
"gccarch-armv8.2-a+fp16+rcpc+dotprod"
|
|
|
|
"gccarch-rv64imac"
|
|
|
|
"gccarch-rv64imacfd"
|
|
|
|
"gccarch-rv64gc"
|
|
|
|
];
|
|
|
|
in ''
|
2024-08-21 15:33:33 +02:00
|
|
|
mkdir -p /root
|
|
|
|
cat <<EOF > /root/nix.conf
|
|
|
|
build-users-group = nixbld
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
sandbox = true
|
|
|
|
substituters = https://cache.kyouma.net https://cache.nixos.org
|
|
|
|
trusted-public-keys = cache.kyouma.net:Frjwu4q1rnwE/MnSTmX9yx86GNA/z3p/oElGvucLiZg= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
|
|
|
|
max-substitution-jobs = 20
|
|
|
|
max-silent-time = 14400
|
2024-10-18 16:17:20 +02:00
|
|
|
min-free = ${builtins.toString (49152 * 1024 * 1024)}
|
|
|
|
max-free = ${builtins.toString (65536 * 1024 * 1024)}
|
2024-11-29 22:34:55 +01:00
|
|
|
system-features = ${toString system-features}
|
2024-08-21 15:33:33 +02:00
|
|
|
EOF
|
|
|
|
|
|
|
|
mkdir -p /root/.ssh
|
|
|
|
cat <<EOF > /root/.ssh/authorized_keys
|
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA/+iN407+HsfHbbC3tfdA8Yf4TZ08qXQMb4tb/SDAs+ emily@card
|
2024-10-10 21:43:11 +02:00
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK397sBHLS66snWNPtmjUy7qZxRJh54N0RRXogKODudl nix@muon
|
2024-08-21 15:33:33 +02:00
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE/vCXM3IaxJP9v2Y+xcQrQD2IcffgdzqtWhpMjj9Xl5 hydra@seras
|
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICT0dGyLUjxFnvqUmex+5xUGQ7D4yGHKo267JgApcq0k root@ryuuko
|
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIDTwCSWYODyvTJxwB6Rahuy0j6s/YYwtQta8bjzG/We root@ryuuko-arch
|
2024-10-10 21:43:11 +02:00
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM/RmFnel8pcZT9nh7EAfKfAekt3BoEXy0G7G2GTacN/ aprl@computer
|
|
|
|
ss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dOSwubn1bs5Lt6YYRDU24NV6CGrwKgCJSRxzNMLwpnFKiSXpO8FzkqWHYWyju141hQcFF31aZIV+7YcwEt5ZukLjFOpVtpbSXvJYigOUzGi34P3/OAGshDXjTQjvM8GIir49gx3b2Nwhg0z4UHBkAKZvDDFPHDMJoclvnhITojaAojfC9zmMCO5ZaEsk8yv7c/lWQumzRpfldWF4mwHvhD5kTADbhRdO7WTdX7AaiAYINooToeWKjFe2wn3rFubPUppptqtP03mmvs7vhhgnEVBbGZRJK3GTVk1XcsfF9rDKzewSa+wb4LsBoZtFRhc8cJqHGlKWSNk7dQ04B1atPyNLKGpGoo/UIPxyZ6bSqFVxY3nhz46VZ6z8XWI48z0/fRQ== aprl@uwu
|
2024-11-18 14:15:55 +01:00
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAAl3/krXJeCcDEJXRuzOdCOrJLG7b6MRqC+a9Xux3mW vika@hydrangea
|
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHQjTy9qqHcs5vgTz+iMAiNNMqdyGtOhEpnpJCReEFfZ vika@rafflesia
|
|
|
|
sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAINAgFdk78I4zssUGsAIV01zefLBpwc1W7hfTobbG80XLAAAABHNzaDo= vika@nitrokey
|
2024-08-21 15:33:33 +02:00
|
|
|
EOF
|
|
|
|
|
|
|
|
cat <<EOF > /root/.ssh/environment
|
|
|
|
PATH=/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat <<EOF > /root/sshd_config
|
|
|
|
AcceptEnv GIT_PROTOCOL
|
|
|
|
AuthenticationMethods publickey
|
|
|
|
AuthorizedPrincipalsFile none
|
|
|
|
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com
|
|
|
|
GatewayPorts no
|
|
|
|
HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-ed25519,sk-ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com
|
|
|
|
KbdInteractiveAuthentication no
|
|
|
|
KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org
|
|
|
|
LogLevel INFO
|
|
|
|
Macs umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com
|
|
|
|
PasswordAuthentication no
|
|
|
|
PermitRootLogin prohibit-password
|
|
|
|
PermitUserEnvironment yes
|
|
|
|
PrintMotd no
|
|
|
|
PubkeyAcceptedAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-ed25519,sk-ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com
|
|
|
|
StreamLocalBindUnlink yes
|
|
|
|
StrictModes yes
|
|
|
|
UseDns no
|
|
|
|
UsePAM no
|
|
|
|
X11Forwarding no
|
|
|
|
Banner none
|
|
|
|
AddressFamily any
|
|
|
|
Port 2222
|
|
|
|
|
|
|
|
Subsystem sftp ${openssh}/libexec/sftp-server
|
|
|
|
AuthorizedKeysFile %h/.ssh/authorized_keys /etc/ssh/authorized_keys.d/%u
|
|
|
|
HostKey /mnt/data/ssh/ssh_host_ed25519_key
|
|
|
|
EOF
|
|
|
|
|
|
|
|
mkdir -p /etc/keys
|
|
|
|
mkdir -p /var/empty
|
|
|
|
mkdir -p /var/log
|
|
|
|
|
2024-11-29 20:42:04 +01:00
|
|
|
substitute ${./entrypoint.sh} /entrypoint.sh \
|
|
|
|
--subst-var-by qemu-aarch64 ${lib.getExe' qemu-user "qemu-aarch64"} \
|
|
|
|
--subst-var-by qemu-riscv64 ${lib.getExe' qemu-user "qemu-riscv64"}
|
2024-08-21 15:33:33 +02:00
|
|
|
chmod +x /entrypoint.sh
|
|
|
|
'';
|
|
|
|
}
|