Use ZFS storage driver for containers

This commit is contained in:
coolneng 2022-12-20 14:03:09 +01:00
parent 8ea60d90df
commit 5da50e5290
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 69 additions and 50 deletions

View File

@ -23,39 +23,38 @@
fsType = "vfat";
};
fileSystems."/var/lib/containers/storage/overlay" =
{ device = "/var/lib/containers/storage/overlay";
fsType = "none";
options = [ "bind" ];
};
fileSystems."/var/lib/containers/storage/overlay-containers/dba1864ff1473b3ba5fddd103f9cfff67334fbcc5c99c42b619e8a6d88776061/userdata/shm" =
{ device = "shm";
fsType = "tmpfs";
};
fileSystems."/var/lib/containers/storage/overlay/1990fed1fbfbe8dc75ded251c84e8d82700fef0f01e8ead81916cadc5ec2cac1/merged" =
{ device = "overlay";
fsType = "overlay";
};
fileSystems."/vault" =
{ device = "vault";
fsType = "zfs";
};
fileSystems."/vault/radicale" =
{ device = "vault/radicale";
fileSystems."/var/lib/signald" =
{ device = "vault/state_directories/signald";
fsType = "zfs";
};
fileSystems."/vault/syncthing" =
{ device = "vault/syncthing";
fileSystems."/var/lib/gitea" =
{ device = "vault/state_directories/gitea";
fsType = "zfs";
};
fileSystems."/vault/backups" =
{ device = "vault/backups";
fileSystems."/var/lib/wallabag" =
{ device = "vault/state_directories/wallabag";
fsType = "zfs";
};
fileSystems."/var/lib/matrix-as-telegram" =
{ device = "vault/state_directories/matrix-as-telegram";
fsType = "zfs";
};
fileSystems."/var/lib/matrix-as-signal" =
{ device = "vault/state_directories/matrix-as-signal";
fsType = "zfs";
};
fileSystems."/var/lib/matrix-as-facebook" =
{ device = "vault/state_directories/matrix-as-facebook";
fsType = "zfs";
};
@ -69,6 +68,21 @@
fsType = "zfs";
};
fileSystems."/vault/backups" =
{ device = "vault/backups";
fsType = "zfs";
};
fileSystems."/vault/radicale" =
{ device = "vault/radicale";
fsType = "zfs";
};
fileSystems."/vault/syncthing" =
{ device = "vault/syncthing";
fsType = "zfs";
};
fileSystems."/vault/backups/monolith" =
{ device = "vault/backups/monolith";
fsType = "zfs";
@ -84,33 +98,18 @@
fsType = "zfs";
};
fileSystems."/var/lib/wallabag" =
{ device = "vault/state_directories/wallabag";
fileSystems."/var/lib/containers" =
{ device = "vault/containers";
fsType = "zfs";
};
fileSystems."/var/lib/gitea" =
{ device = "vault/state_directories/gitea";
fsType = "zfs";
fileSystems."/var/lib/containers/storage/zfs-containers/7521f1406d193340f67dfea6538f5ba05b19c61f757917f13e12b70287841045/userdata/shm" =
{ device = "shm";
fsType = "tmpfs";
};
fileSystems."/var/lib/signald" =
{ device = "vault/state_directories/signald";
fsType = "zfs";
};
fileSystems."/var/lib/matrix-as-signal" =
{ device = "vault/state_directories/matrix-as-signal";
fsType = "zfs";
};
fileSystems."/var/lib/matrix-as-facebook" =
{ device = "vault/state_directories/matrix-as-facebook";
fsType = "zfs";
};
fileSystems."/var/lib/matrix-as-telegram" =
{ device = "vault/state_directories/matrix-as-telegram";
fileSystems."/var/lib/containers/storage/zfs/graph/6bf2a36ab4d55af9e693f55018f5b2fd38b6aae285183b8680969f5820bd0be9" =
{ device = "vault/containers/6bf2a36ab4d55af9e693f55018f5b2fd38b6aae285183b8680969f5820bd0be9";
fsType = "zfs";
};
@ -123,7 +122,7 @@
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.cni-podman0.useDHCP = lib.mkDefault true;
# networking.interfaces.eth0.useDHCP = lib.mkDefault true;
# networking.interfaces.veth65ee03c8.useDHCP = lib.mkDefault true;
# networking.interfaces.veth8009136e.useDHCP = lib.mkDefault true;
# networking.interfaces.wg0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlan0.useDHCP = lib.mkDefault true;

View File

@ -31,11 +31,31 @@
# Set environment variable pointing to wallabag configuration directory
environment.variables.WALLABAG_DATA = "/var/lib/wallabag";
# Openbooks configuration
virtualisation.oci-containers.containers = {
openbooks = {
image = "evanbuss/openbooks:latest";
ports = [ "127.0.0.1:9000:80" ];
# Podman setup with ZFS
virtualisation = {
containers.enable = true;
containers.storage.settings.storage = {
driver = "zfs";
graphroot = "/var/lib/containers/storage";
runroot = "/run/containers/storage";
};
podman = {
enable = true;
dockerCompat = true;
extraPackages = with pkgs; [ zfs ];
};
# Openbooks configuration
oci-containers = {
backend = "podman";
containers = {
openbooks = {
image = "evanbuss/openbooks:latest";
ports = [ "127.0.0.1:9000:80" ];
};
};
};
};
}