nix-config/hosts/nfsroot/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.6 KiB
Nix
Raw Normal View History

2024-02-22 17:46:37 +01:00
{ config, lib, pkgs, ... }:
2022-06-07 20:22:25 +02:00
let
nfsExports = [
"var/lib/nfsroot/dacbert"
"var/lib/nfsroot/riscbert"
"var/lib/dump-dvb/whoopsie"
];
2024-02-22 17:46:37 +01:00
reinstallDacbert = pkgs.writeScriptBin "reinstall-dacbert" ''
2024-02-23 23:42:07 +01:00
SYSTEM=$(${lib.getExe pkgs.curl} -sLH "Accept: application/json" \
2024-02-22 17:46:37 +01:00
https://hydra.hq.c3d2.de/job/c3d2/nix-config/dacbert/latest \
2024-02-23 23:42:07 +01:00
| ${lib.getExe pkgs.jq} -er .buildoutputs.out.path
2024-02-22 17:46:37 +01:00
)
2024-02-23 23:42:07 +01:00
BOOT=$(${lib.getExe pkgs.curl} -sLH "Accept: application/json" \
2024-02-22 17:46:37 +01:00
https://hydra.hq.c3d2.de/job/c3d2/nix-config/dacbert-tftproot/latest \
2024-02-23 23:42:07 +01:00
| ${lib.getExe pkgs.jq} -er .buildoutputs.out.path
2024-02-22 17:46:37 +01:00
)
2024-02-23 23:42:07 +01:00
${lib.getExe config.nix.package} --extra-experimental-features nix-command \
2024-02-22 17:46:37 +01:00
copy \
--from https://nix-cache.hq.c3d2.de \
--to /var/lib/nfsroot/dacbert \
--no-check-sigs \
$SYSTEM $BOOT
cp /var/lib/nfsroot/dacbert/$BOOT/* /var/lib/nfsroot/dacbert/boot/
'';
2022-06-07 20:22:25 +02:00
in {
imports = [
./tftp.nix
./nfs.nix
];
2022-06-07 20:15:09 +02:00
microvm = {
hypervisor = "cloud-hypervisor";
mem = 2048;
2022-06-17 00:05:32 +02:00
2023-06-14 22:35:43 +02:00
storeDiskType = "erofs";
2022-09-14 21:34:44 +02:00
2022-06-17 00:05:32 +02:00
volumes = map (export: {
mountPoint = "/${export}";
image = "/dev/zvol/server10-root/vm/nfsroot/${builtins.baseNameOf export}";
2022-06-17 00:05:32 +02:00
autoCreate = false;
}) nfsExports;
2022-06-16 22:41:04 +02:00
};
2024-01-11 22:07:41 +01:00
c3d2.deployment = {
server = "server10";
};
2022-06-07 20:15:09 +02:00
fileSystems = builtins.foldl' (fileSystems: export: fileSystems // {
"/${export}".options = [ "relatime" "discard" ];
2024-01-11 22:30:23 +01:00
}) {} nfsExports;
networking = {
hostName = "nfsroot";
firewall.enable = false;
};
2022-06-07 20:15:09 +02:00
2024-02-22 17:46:37 +01:00
environment.systemPackages = [ reinstallDacbert ];
2022-06-07 20:15:09 +02:00
system.stateVersion = "22.05";
}