From 0e04f0ccd6a0fceca813e58024446342a1121b6e Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Sun, 9 Jun 2024 16:26:05 +0300 Subject: [PATCH] wip --- container/Cloud.nix | 27 +++++++++++++++++++++++++++ container/Paste.nix | 20 ++------------------ container/Postgres.nix | 13 +------------ container/Proxy.nix | 13 +------------ 4 files changed, 31 insertions(+), 42 deletions(-) create mode 100644 container/Cloud.nix diff --git a/container/Cloud.nix b/container/Cloud.nix new file mode 100644 index 0000000..c4b98c4 --- /dev/null +++ b/container/Cloud.nix @@ -0,0 +1,27 @@ +{ storage +, mkContainer +, mkContainerConfig +, mkContainerDir +, ... } @args: let + address = "10.1.0.13"; + path = "${storage}/cloud"; +in { + systemd.tmpfiles.rules = map (dir: mkContainerDir "${path}/${dir}") [ + "data" + ]; + + containers.postgres = mkContainer address { + bindMounts = { + "/var/www/html" = { + hostPath = "${path}/data"; + isReadOnly = false; + }; + }; + + config = { ... }: mkContainerConfig { + services.nextcloud = { + enable = true; + }; + }; + }; +} diff --git a/container/Paste.nix b/container/Paste.nix index c05c2b2..49915d3 100644 --- a/container/Paste.nix +++ b/container/Paste.nix @@ -1,6 +1,5 @@ { pkgs , storage -, const , domain , util , mkContainer @@ -39,23 +38,8 @@ in { }; }; - config = { config, lib, ... }: mkContainerConfig { - system.stateVersion = const.stateVersion; - - users.users.root.password = ""; - users.mutableUsers = false; - - networking = { - useHostResolvConf = lib.mkForce false; - firewall.enable = false; - }; - - environment = { - systemPackages = [ package pkgs.neovim ]; - variables = { - }; - }; - + config = { config, ... }: mkContainerConfig { + environment.systemPackages = [ package ]; systemd.packages = [ package ]; users.users.paste = { diff --git a/container/Postgres.nix b/container/Postgres.nix index 9c664cc..8d9efdb 100644 --- a/container/Postgres.nix +++ b/container/Postgres.nix @@ -1,5 +1,4 @@ { storage -, const , host , mkContainer , mkContainerConfig @@ -20,17 +19,7 @@ in { }; }; - config = { lib, pkgs, ... }: mkContainerConfig { - system.stateVersion = const.stateVersion; - - users.users.root.password = ""; - users.mutableUsers = false; - - networking = { - useHostResolvConf = lib.mkForce false; - firewall.enable = false; - }; - + config = { pkgs, ... }: mkContainerConfig { services.postgresql = let databases = [ "privatebin" diff --git a/container/Proxy.nix b/container/Proxy.nix index 5aa39ce..9a8cbe1 100644 --- a/container/Proxy.nix +++ b/container/Proxy.nix @@ -1,5 +1,4 @@ { storage -, const , util , domain , mkContainer @@ -27,17 +26,7 @@ in { }; }; - config = { lib, pkgs, ... }: mkContainerConfig { - system.stateVersion = const.stateVersion; - - users.users.root.password = ""; - users.mutableUsers = false; - - networking = { - useHostResolvConf = lib.mkForce false; - firewall.enable = false; - }; - + config = { pkgs, ... }: mkContainerConfig { environment.systemPackages = with pkgs; [ certbot ]; services.nginx = {