mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-20 09:47:57 +02:00
containers: Fix warning when containers are disabled
Now it's possible to disable the containers without getting a warning that containers.<name> is being defined.
This commit is contained in:
parent
8ba4792d03
commit
3080c56023
@ -1,7 +1,9 @@
|
|||||||
{ config, nix-config, sakaya, ... }:
|
{ config, nix-config, sakaya, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib) mkIf;
|
||||||
inherit (config.modules.system) username;
|
inherit (config.modules.system) username;
|
||||||
|
inherit (config.boot) enableContainers;
|
||||||
|
|
||||||
template = {
|
template = {
|
||||||
privateNetwork = true;
|
privateNetwork = true;
|
||||||
@ -48,68 +50,70 @@ in
|
|||||||
"d /run/user/1000 0700 ${username} users -"
|
"d /run/user/1000 0700 ${username} users -"
|
||||||
];
|
];
|
||||||
|
|
||||||
containers.wine = template // {
|
containers = mkIf enableContainers {
|
||||||
hostAddress = "192.168.100.34";
|
wine = template // {
|
||||||
localAddress = "192.168.100.49";
|
hostAddress = "192.168.100.34";
|
||||||
|
localAddress = "192.168.100.49";
|
||||||
|
|
||||||
config = { lib, pkgs, ... }: {
|
config = { lib, pkgs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
../containers/shared.nix
|
../containers/shared.nix
|
||||||
];
|
|
||||||
|
|
||||||
networking.nat.forwardPorts = [
|
|
||||||
{
|
|
||||||
destination = "192.168.100.49:39493";
|
|
||||||
sourcePort = 39493;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
destination = "192.168.100.49:5029";
|
|
||||||
sourcePort = 5029;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [
|
|
||||||
39493
|
|
||||||
5029
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.services.sakaya = {
|
|
||||||
enable = true;
|
|
||||||
description = "sakaya server";
|
|
||||||
|
|
||||||
unitConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
};
|
|
||||||
|
|
||||||
path = with pkgs; [
|
|
||||||
su
|
|
||||||
];
|
];
|
||||||
|
|
||||||
serviceConfig = {
|
networking.nat.forwardPorts = [
|
||||||
ExecStart = "/usr/bin/env su ${username} --command=${sakaya.packages.${pkgs.system}.sakaya}/bin/sakaya";
|
{
|
||||||
|
destination = "192.168.100.49:39493";
|
||||||
|
sourcePort = 39493;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
destination = "192.168.100.49:5029";
|
||||||
|
sourcePort = 5029;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
39493
|
||||||
|
5029
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.services.sakaya = {
|
||||||
|
enable = true;
|
||||||
|
description = "sakaya server";
|
||||||
|
|
||||||
|
unitConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
};
|
||||||
|
|
||||||
|
path = with pkgs; [
|
||||||
|
su
|
||||||
|
];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "/usr/bin/env su ${username} --command=${sakaya.packages.${pkgs.system}.sakaya}/bin/sakaya";
|
||||||
|
};
|
||||||
|
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
environment.systemPackages = with pkgs; [
|
||||||
};
|
wineWowPackages.waylandFull
|
||||||
|
winetricks
|
||||||
|
sakaya.packages.${system}.sakaya
|
||||||
|
rar
|
||||||
|
unrar
|
||||||
|
iamb
|
||||||
|
srb2
|
||||||
|
];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||||
wineWowPackages.waylandFull
|
"rar"
|
||||||
winetricks
|
"unrar"
|
||||||
sakaya.packages.${system}.sakaya
|
];
|
||||||
rar
|
|
||||||
unrar
|
|
||||||
iamb
|
|
||||||
srb2
|
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
environment.sessionVariables = {
|
||||||
"rar"
|
LC_ALL = "ja_JP.UTF-8";
|
||||||
"unrar"
|
TZ = "Asia/Tokyo";
|
||||||
];
|
};
|
||||||
|
|
||||||
environment.sessionVariables = {
|
|
||||||
LC_ALL = "ja_JP.UTF-8";
|
|
||||||
TZ = "Asia/Tokyo";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user