From 7b51bbd3936fe81e0250f02288bc1cde1b9155bf Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Sat, 30 Dec 2023 10:18:31 -0500 Subject: [PATCH] Fix import strategy --- configuration.nix | 2 +- services.nix | 26 -------------------------- services/conduit.nix | 5 +++++ services/default.nix | 6 ++++++ services/load-balancer.nix | 1 + 5 files changed, 13 insertions(+), 27 deletions(-) delete mode 100644 services.nix create mode 100644 services/conduit.nix create mode 100644 services/default.nix create mode 100644 services/load-balancer.nix diff --git a/configuration.nix b/configuration.nix index 719c1e4..d7a3e4f 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,7 +8,7 @@ ./common ./common/sites/gifford ./common/server - ./services.nix + ./services ]; boot.loader = { grub = { diff --git a/services.nix b/services.nix deleted file mode 100644 index 24360a8..0000000 --- a/services.nix +++ /dev/null @@ -1,26 +0,0 @@ -{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 diff --git a/services/conduit.nix b/services/conduit.nix new file mode 100644 index 0000000..cb5fc61 --- /dev/null +++ b/services/conduit.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: import ../common/services/conduit.nix { + dataset = "gc1_srv"; + pkgs = pkgs; + domain = "chat.techwork.zone"; +} \ No newline at end of file diff --git a/services/default.nix b/services/default.nix new file mode 100644 index 0000000..2adf631 --- /dev/null +++ b/services/default.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: { + imports = [ + ./load-balancer.nix + ./conduit.nix + ]; +} \ No newline at end of file diff --git a/services/load-balancer.nix b/services/load-balancer.nix new file mode 100644 index 0000000..2e8c9e4 --- /dev/null +++ b/services/load-balancer.nix @@ -0,0 +1 @@ +{pkgs, ...}: import ../common/services/load-balancer { dataset = "gc1_srv"; pkgs = pkgs; } \ No newline at end of file