nix-config/modules/containers.nix

81 lines
1.5 KiB
Nix
Raw Normal View History

2024-08-03 20:40:07 +02:00
{
config,
nix-config,
lib,
2024-09-10 05:08:01 +02:00
pkgs,
2024-08-03 20:40:07 +02:00
...
}:
2023-06-23 21:48:29 +02:00
let
inherit (lib) mkIf;
inherit (config.modules.system) username;
inherit (config.boot) enableContainers;
template = {
privateNetwork = true;
ephemeral = 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
{
2024-09-10 05:08:01 +02:00
environment.systemPackages = mkIf (pkgs.system == "x86_64-linux") (
with nix-config.inputs.sakaya.packages.${pkgs.system}; [ sakaya ]
);
containers = mkIf enableContainers {
wine = template // {
hostAddress = "192.168.100.34";
localAddress = "192.168.100.49";
2024-10-11 21:13:08 +02:00
config = ../containers/wine.nix;
2023-06-11 15:51:26 +02:00
};
wordpress = {
privateNetwork = true;
ephemeral = true;
autoStart = true;
hostAddress = "192.168.100.24";
localAddress = "192.168.100.39";
specialArgs = {
inherit nix-config;
};
config = ../containers/wordpress.nix;
};
};
}