nfsroot: export volumes not shares via nfs
This commit is contained in:
parent
0324645bc9
commit
7fb37eb03c
|
@ -1,6 +1,12 @@
|
||||||
{ zentralwerk, config, lib, pkgs, ... }:
|
{ zentralwerk, config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
netConfig = zentralwerk.lib.config.site.net.serv;
|
netConfig = zentralwerk.lib.config.site.net.serv;
|
||||||
|
|
||||||
|
nfsExports = [
|
||||||
|
"var/lib/nfsroot/dacbert"
|
||||||
|
"var/lib/nfsroot/riscbert"
|
||||||
|
"var/lib/dump-dvb/whoopsie"
|
||||||
|
];
|
||||||
in {
|
in {
|
||||||
microvm = {
|
microvm = {
|
||||||
hypervisor = "qemu";
|
hypervisor = "qemu";
|
||||||
|
@ -17,7 +23,13 @@ in {
|
||||||
tag = builtins.baseNameOf dir;
|
tag = builtins.baseNameOf dir;
|
||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
socket = "${builtins.baseNameOf dir}.socket";
|
socket = "${builtins.baseNameOf dir}.socket";
|
||||||
}) [ "etc" "home" "var" "var/lib/nfsroot/dacbert" "var/lib/nfsroot/riscbert" "var/lib/dump-dvb/whoopsie" ];
|
}) [ "etc" "home" "var" ];
|
||||||
|
|
||||||
|
volumes = map (export: {
|
||||||
|
mountPoint = "/${export}";
|
||||||
|
image = "/dev/zvol/${config.networking.hostName}/vm/nfsroot/${builtins.baseNameOf export}";
|
||||||
|
autoCreate = false;
|
||||||
|
}) nfsExports;
|
||||||
|
|
||||||
interfaces = [ {
|
interfaces = [ {
|
||||||
type = "tap";
|
type = "tap";
|
||||||
|
@ -26,6 +38,10 @@ in {
|
||||||
} ];
|
} ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileSystems = builtins.foldl' (fileSystems: export: fileSystems // {
|
||||||
|
"/${export}".options = [ "relatime" "discard" ];
|
||||||
|
}) {} nfsExports;
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "nfsroot";
|
hostName = "nfsroot";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue