From f4d23d678463ebe81ba5676fa4345cb47015a931 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Thu, 31 Aug 2023 14:08:35 -0400 Subject: [PATCH] refactor(containers): Abstract common config This makes it possible to create multiple containers without duplicating code. This may be useful for having an internet container and a no internet container. --- containers/default.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/containers/default.nix b/containers/default.nix index fea50fea..a6c5faa8 100644 --- a/containers/default.nix +++ b/containers/default.nix @@ -4,17 +4,11 @@ , ... }: -{ - systemd.tmpfiles.rules = [ - "d /run/user/1000 0700 user users -" - ]; - - containers.wine = { +let + template = { privateNetwork = true; ephemeral = true; autoStart = true; - hostAddress = "192.168.100.34"; - localAddress = "192.168.100.49"; bindMounts = { "/mnt" = { @@ -44,6 +38,15 @@ node = "/dev/dri/renderD128"; } ]; + }; +in { + systemd.tmpfiles.rules = [ + "d /run/user/1000 0700 user users -" + ]; + + containers.wine = template // { + hostAddress = "192.168.100.34"; + localAddress = "192.168.100.49"; config = { lib, pkgs, ... }: { imports = [