From da23b55bfbabc0c0a7e1696d54fc5401946e8186 Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Fri, 29 Dec 2023 07:39:26 -0500 Subject: [PATCH] add services.nix --- services.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 services.nix diff --git a/services.nix b/services.nix new file mode 100644 index 0000000..24360a8 --- /dev/null +++ b/services.nix @@ -0,0 +1,26 @@ +{pkgs, ...}: { + environment.etc."srv/docker-compose.yml" = builtins.readFile ./docker-compose.yml; + + systemd.services.load-balancer = let dataset = "gc1_srv"; + in { + wantedBy = ["multi-user.target"]; + requires = ["public-network.service" + "zfs-import-${dataset}.service"]; + after = ["public-network.service" + "zfs-import-${dataset}.service"]; + serviceConfig = { + ExecStart = "${pkgs.docker}/bin/docker compose up"; + WorkingDirectory = "/etc/srv/load-balancer"; + }; + }; + +} +# '//' in nix means "merge attribute sets". We're importing a function at the +# path, then calling it with the attr set as an argument, and merging the +# results with the config above +// import ./common/services/load-balancer { dataset = "gc1_srv"; pkgs = pkgs; } +// import ./common/services/conduit.nix { + dataset = "gc1_srv"; + pkgs = pkgs; + domain = "chat.techwork.zone"; +} \ No newline at end of file