mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-28 19:23:48 +01:00
a7fad6beb9
At some point this started causing the /run/user/1000 directory to be deleted when changing container configurations, which was definitely not ideal. An alternative approach will have to be taken if we want the wine container to auto-start on boot.
81 lines
1.5 KiB
Nix
81 lines
1.5 KiB
Nix
{
|
|
config,
|
|
nix-config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
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;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
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";
|
|
config = ../containers/wine.nix;
|
|
};
|
|
|
|
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;
|
|
};
|
|
};
|
|
}
|