nix-config/modules/containers.nix

67 lines
1.2 KiB
Nix
Raw Normal View History

{ config, nix-config, lib, ... }:
2023-06-23 21:48:29 +02:00
let
inherit (lib) mkIf;
inherit (config.modules.system) username phone;
inherit (config.boot) enableContainers;
template = {
privateNetwork = true;
ephemeral = true;
autoStart = true;
restartIfChanged = false;
bindMounts = {
"/mnt" = {
hostPath = "/home/${username}/containers/wine";
isReadOnly = false;
};
waylandDisplay = rec {
hostPath = "/run/user/1000";
mountPoint = hostPath;
};
x11Display = rec {
hostPath = "/tmp/.X11-unix";
mountPoint = hostPath;
};
dri = rec {
hostPath = "/dev/dri";
mountPoint = hostPath;
};
};
allowedDevices = [
{
modifier = "rw";
node = "/dev/dri/renderD128";
}
];
specialArgs = {
inherit nix-config;
};
};
2023-08-31 20:16:29 +02:00
in
{
systemd.tmpfiles.rules = [
"d /run/user/1000 0700 ${username} users -"
];
containers = mkIf (enableContainers && !phone) {
wine = template // {
hostAddress = "192.168.100.34";
localAddress = "192.168.100.49";
2024-04-07 16:41:16 +02:00
config = { ... }: {
imports = [
../containers
../containers/wine.nix
];
};
2023-06-11 15:51:26 +02:00
};
};
}