Use latest zfs compatible kernel
This commit is contained in:
parent
ae05bdb2dd
commit
253720c398
|
@ -8,6 +8,8 @@
|
|||
};
|
||||
|
||||
config = {
|
||||
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||
|
||||
# just all the microvms from this flake
|
||||
# that are supposed to run on the server
|
||||
microvm.autostart =
|
||||
|
@ -18,44 +20,47 @@
|
|||
(config.c3d2.deployment.server or null) == config.networking.hostName
|
||||
) (builtins.attrNames self.nixosConfigurations);
|
||||
|
||||
systemd.services."microvm-virtiofsd@" = {
|
||||
requires = [ "microvm-zfs-datasets@%i.service" ];
|
||||
};
|
||||
systemd.services."microvm-zfs-datasets@" = {
|
||||
description = "Create ZFS datasets for MicroVM '%i'";
|
||||
before = [ "microvm-virtiofsd@%i.service" ];
|
||||
after = [ "local-fs.target" ];
|
||||
partOf = [ "microvm@%i.service" ];
|
||||
unitConfig.ConditionPathExists = "/var/lib/microvms/%i/current/share/microvm/virtiofs";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
WorkingDirectory = "/var/lib/microvms/%i";
|
||||
SyslogIdentifier = "microvm-zfs-datasets@%i";
|
||||
systemd.services = {
|
||||
"microvm-virtiofsd@" = {
|
||||
requires = [ "microvm-zfs-datasets@%i.service" ];
|
||||
};
|
||||
path = with pkgs; [ zfs ];
|
||||
scriptArgs = "%i";
|
||||
script = ''
|
||||
zfsExists() {
|
||||
zfs list $1 >/dev/null 2>/dev/null
|
||||
}
|
||||
|
||||
NAME="$1"
|
||||
BASE="${config.c3d2.deployment.microvmBaseZfsDataset}"
|
||||
zfsExists $BASE || \
|
||||
zfs create $BASE
|
||||
zfsExists $BASE/$NAME || \
|
||||
zfs create $BASE/$NAME
|
||||
for d in current/share/microvm/virtiofs/*; do
|
||||
SOURCE=$(cat $d/source)
|
||||
TAG=$(basename $d)
|
||||
MNT=$SOURCE
|
||||
if [[ "$MNT" == /var/lib/microvms/$NAME/* ]]; then
|
||||
zfsExists $BASE/$NAME/$TAG || \
|
||||
zfs create -o mountpoint=$MNT $BASE/$NAME/$TAG
|
||||
fi
|
||||
done
|
||||
'';
|
||||
"microvm-zfs-datasets@" = {
|
||||
description = "Create ZFS datasets for MicroVM '%i'";
|
||||
before = [ "microvm-virtiofsd@%i.service" ];
|
||||
after = [ "local-fs.target" ];
|
||||
partOf = [ "microvm@%i.service" ];
|
||||
unitConfig.ConditionPathExists = "/var/lib/microvms/%i/current/share/microvm/virtiofs";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
WorkingDirectory = "/var/lib/microvms/%i";
|
||||
SyslogIdentifier = "microvm-zfs-datasets@%i";
|
||||
};
|
||||
path = with pkgs; [ zfs ];
|
||||
scriptArgs = "%i";
|
||||
script = ''
|
||||
zfsExists() {
|
||||
zfs list $1 >/dev/null 2>/dev/null
|
||||
}
|
||||
|
||||
NAME="$1"
|
||||
BASE="${config.c3d2.deployment.microvmBaseZfsDataset}"
|
||||
zfsExists $BASE || \
|
||||
zfs create $BASE
|
||||
zfsExists $BASE/$NAME || \
|
||||
zfs create $BASE/$NAME
|
||||
for d in current/share/microvm/virtiofs/*; do
|
||||
SOURCE=$(cat $d/source)
|
||||
TAG=$(basename $d)
|
||||
MNT=$SOURCE
|
||||
if [[ "$MNT" == /var/lib/microvms/$NAME/* ]]; then
|
||||
zfsExists $BASE/$NAME/$TAG || \
|
||||
zfs create -o mountpoint=$MNT $BASE/$NAME/$TAG
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nix.settings = {
|
||||
|
|
Loading…
Reference in New Issue