2024-04-05 01:38:57 +02:00
|
|
|
{ config, stylix, home-manager, sakaya, ... }:
|
2023-06-23 21:48:29 +02:00
|
|
|
|
2023-08-31 20:08:35 +02:00
|
|
|
let
|
2024-04-05 01:38:57 +02:00
|
|
|
inherit (config.modules.system) username;
|
|
|
|
|
2023-08-31 20:08:35 +02:00
|
|
|
template = {
|
2023-06-03 21:29:49 +02:00
|
|
|
privateNetwork = true;
|
2023-06-16 20:21:23 +02:00
|
|
|
ephemeral = true;
|
2023-08-02 04:21:59 +02:00
|
|
|
autoStart = true;
|
2023-10-11 00:38:13 +02:00
|
|
|
restartIfChanged = false;
|
2023-06-03 21:29:49 +02:00
|
|
|
|
|
|
|
bindMounts = {
|
2023-06-22 17:43:19 +02:00
|
|
|
"/mnt" = {
|
2024-04-05 01:38:57 +02:00
|
|
|
hostPath = "/home/${username}/containers/wine";
|
2023-06-03 21:29:49 +02:00
|
|
|
isReadOnly = false;
|
|
|
|
};
|
2023-06-03 21:36:26 +02:00
|
|
|
|
|
|
|
waylandDisplay = rec {
|
|
|
|
hostPath = "/run/user/1000";
|
|
|
|
mountPoint = hostPath;
|
|
|
|
};
|
|
|
|
|
|
|
|
x11Display = rec {
|
|
|
|
hostPath = "/tmp/.X11-unix";
|
|
|
|
mountPoint = hostPath;
|
|
|
|
};
|
2023-06-16 20:22:57 +02:00
|
|
|
|
|
|
|
dri = rec {
|
|
|
|
hostPath = "/dev/dri";
|
|
|
|
mountPoint = hostPath;
|
|
|
|
};
|
2023-06-03 21:29:49 +02:00
|
|
|
};
|
|
|
|
|
2023-06-16 20:22:57 +02:00
|
|
|
allowedDevices = [
|
|
|
|
{
|
|
|
|
modifier = "rw";
|
|
|
|
node = "/dev/dri/renderD128";
|
|
|
|
}
|
|
|
|
];
|
2023-08-31 20:08:35 +02:00
|
|
|
};
|
2023-08-31 20:16:29 +02:00
|
|
|
in
|
|
|
|
{
|
2023-08-31 20:08:35 +02:00
|
|
|
systemd.tmpfiles.rules = [
|
2024-04-05 14:20:10 +02:00
|
|
|
"d /run/user/1000 0700 ${username} users -"
|
2023-08-31 20:08:35 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
containers.wine = template // {
|
|
|
|
hostAddress = "192.168.100.34";
|
|
|
|
localAddress = "192.168.100.49";
|
2023-06-16 20:22:57 +02:00
|
|
|
|
2023-08-31 17:55:23 +02:00
|
|
|
config = { lib, pkgs, ... }: {
|
2023-06-16 20:20:11 +02:00
|
|
|
imports = [
|
2023-06-22 18:51:35 +02:00
|
|
|
stylix.nixosModules.stylix
|
|
|
|
home-manager.nixosModules.home-manager
|
2024-04-01 12:24:36 +02:00
|
|
|
../containers/shared.nix
|
2023-06-16 20:20:11 +02:00
|
|
|
];
|
2023-06-22 15:50:04 +02:00
|
|
|
|
2023-08-01 18:18:04 +02:00
|
|
|
networking.nat.forwardPorts = [
|
|
|
|
{
|
|
|
|
destination = "192.168.100.49:39493";
|
|
|
|
sourcePort = 39493;
|
|
|
|
}
|
2023-08-31 16:18:27 +02:00
|
|
|
{
|
|
|
|
destination = "192.168.100.49:5029";
|
|
|
|
sourcePort = 5029;
|
|
|
|
}
|
2023-08-01 18:18:04 +02:00
|
|
|
];
|
|
|
|
|
2023-08-31 16:18:27 +02:00
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
39493
|
|
|
|
5029
|
|
|
|
];
|
2023-08-01 18:18:04 +02:00
|
|
|
|
2023-08-02 04:55:21 +02:00
|
|
|
systemd.services.sakaya = {
|
|
|
|
enable = true;
|
|
|
|
description = "sakaya server";
|
|
|
|
|
|
|
|
unitConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
};
|
|
|
|
|
|
|
|
path = with pkgs; [
|
|
|
|
su
|
|
|
|
];
|
|
|
|
|
|
|
|
serviceConfig = {
|
2024-04-05 14:20:10 +02:00
|
|
|
ExecStart = "/usr/bin/env su ${username} --command=${sakaya.packages.${pkgs.system}.sakaya}/bin/sakaya";
|
2023-08-02 04:55:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
|
|
|
|
2023-06-11 15:51:26 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
2023-12-15 08:24:11 +01:00
|
|
|
wineWowPackages.waylandFull
|
2023-06-11 15:51:26 +02:00
|
|
|
winetricks
|
2023-10-28 17:35:05 +02:00
|
|
|
sakaya.packages.${system}.sakaya
|
2023-08-31 16:06:51 +02:00
|
|
|
rar
|
|
|
|
unrar
|
2023-08-31 16:10:12 +02:00
|
|
|
iamb
|
2023-08-31 16:18:27 +02:00
|
|
|
srb2
|
2023-08-31 16:06:51 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
|
|
|
"rar"
|
|
|
|
"unrar"
|
2023-06-11 15:51:26 +02:00
|
|
|
];
|
2023-06-22 20:59:02 +02:00
|
|
|
|
|
|
|
environment.sessionVariables = {
|
|
|
|
LC_ALL = "ja_JP.UTF-8";
|
|
|
|
TZ = "Asia/Tokyo";
|
|
|
|
};
|
2023-06-11 15:51:26 +02:00
|
|
|
};
|
2023-06-03 21:29:49 +02:00
|
|
|
};
|
|
|
|
}
|