diff --git a/configuration.nix b/configuration.nix index 1a7e9d4..719c1e4 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,17 +8,16 @@ ./common ./common/sites/gifford ./common/server + ./services.nix ]; - boot.loader = { grub = { # Use the GRUB 2 boot loader. enable = true; - version = 2; # efiSupport = true; # efiInstallAsRemovable = false; # Define on which hard drive you want to install Grub. - device = "/dev/disk/by-uuid/caab3f5b-b264-4070-8a98-fb267ed31280"; # or "nodev" for efi only + device = "/dev/sda"; # or "nodev" for efi only }; # efi.efiSysMountPoint = "/boot/efi"; # (part of the generated default) }; @@ -46,6 +45,8 @@ services.xserver.layout = "us"; + fileSystems."/srv".options = [ "nofail" ]; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave 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