From e37b3bc3632643ce268ded5c9b0f178835964305 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Fri, 2 Feb 2024 02:42:03 +0100 Subject: [PATCH] Set up intray server setup + change catgirl config --- flake.nix | 4 +- home/features/cli/catgirl.nix | 3 +- hosts/nixos/common/global/default.nix | 1 - .../common/optional/services/acme/default.nix | 4 ++ hosts/nixos/lapetus/default.nix | 1 + hosts/nixos/lapetus/services/intray.nix | 49 +++++++++++++++++++ hosts/nixos/lapetus/services/whoogle.nix | 3 -- 7 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 hosts/nixos/lapetus/services/intray.nix diff --git a/flake.nix b/flake.nix index f6e50d0..6efa6f8 100644 --- a/flake.nix +++ b/flake.nix @@ -177,7 +177,7 @@ home-manager.nixosModules.home-manager { home-manager.users.${user} = import ./home/${hostname}.nix; - home-manager.extraSpecialArgs = specialArgs system; + home-manager.extraSpecialArgs = specialArgs system // { inherit hostname; }; home-manager.useUserPackages = true; stylix.homeManagerIntegration.followSystem = false; @@ -220,7 +220,7 @@ mkHomeConfig = { system, hostname }: home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; - extraSpecialArgs = specialArgs system; + extraSpecialArgs = specialArgs system // { inherit hostname; }; modules = [ ./home/${hostname}.nix ]; }; in diff --git a/home/features/cli/catgirl.nix b/home/features/cli/catgirl.nix index 533e128..00c2ba0 100644 --- a/home/features/cli/catgirl.nix +++ b/home/features/cli/catgirl.nix @@ -1,9 +1,10 @@ # Catgirl is a terminal based irc client -{ config, pkgs, ... }: +{ config, pkgs, hostname ? "hermes", ... }: let mkCatgirlNetwork = network: '' host = ${network}.irc.moonythm.dev save = ${network} + user = ${hostname} port = 6697 ''; in diff --git a/hosts/nixos/common/global/default.nix b/hosts/nixos/common/global/default.nix index 8f71930..742be5d 100644 --- a/hosts/nixos/common/global/default.nix +++ b/hosts/nixos/common/global/default.nix @@ -14,7 +14,6 @@ let # {{{ self management # NOTE: using `pkgs.system` before `module.options` is evaluated # leads to infinite recursion! - inputs.intray.nixosModules.x86_64-linux.default inputs.smos.nixosModules.x86_64-linux.default inputs.tickler.nixosModules.x86_64-linux.default # }}} diff --git a/hosts/nixos/common/optional/services/acme/default.nix b/hosts/nixos/common/optional/services/acme/default.nix index 1a3aabe..baef068 100644 --- a/hosts/nixos/common/optional/services/acme/default.nix +++ b/hosts/nixos/common/optional/services/acme/default.nix @@ -7,4 +7,8 @@ dnsProvider = "porkbun"; environmentFile = config.sops.secrets.porkbun_secrets.path; }; + + environment.persistence."/persist/state".directories = [ + "/var/lib/acme" + ]; } diff --git a/hosts/nixos/lapetus/default.nix b/hosts/nixos/lapetus/default.nix index 617d55e..a200367 100644 --- a/hosts/nixos/lapetus/default.nix +++ b/hosts/nixos/lapetus/default.nix @@ -7,6 +7,7 @@ ./services/syncthing.nix ./services/whoogle.nix ./services/pounce.nix + ./services/intray.nix ./filesystems ./hardware ]; diff --git a/hosts/nixos/lapetus/services/intray.nix b/hosts/nixos/lapetus/services/intray.nix new file mode 100644 index 0000000..8b4c3f0 --- /dev/null +++ b/hosts/nixos/lapetus/services/intray.nix @@ -0,0 +1,49 @@ +{ config, ... }: +let + username = "prescientmoon"; + apiHost = "api.intray.moonythm.dev"; + apiPort = 8402; + webHost = "intray.moonythm.dev"; + webPort = 8403; +in +{ + # {{{ Import intray module + imports = [ + # We patch out the `intray` module to allow manual configuration for nginx + a: + # NOTE: using `pkgs.system` before `module.options` is evaluated + # leads to infinite recursion! + let m = inputs.intray.nixosModules.x86_64-linux.default a; + in + { + inherit (m) options; + config = { inherit (m.config) systemd; }; + } + ]; + # }}} + # {{{ Configure intray + services.intray.production = { + enable = true; + api-server = { + enable = true; + hosts = [ apiHost ]; + port = apiPort; + admins = [ username ]; + }; + web-server = { + enable = true; + hosts = [ webHost ]; + port = webPort; + api-url = "https://${apiHost}"; + }; + }; + # }}} + # {{{ Networking & storage + services.nginx.virtualHosts.${apiHost} = config.satellite.proxy apiPort; + services.nginx.virtualHosts.${webHost} = config.satellite.proxy webPort; + + environment.persistence."/persist/state".directories = [ + "/www/intray/production/data" + ]; + # }}} +} diff --git a/hosts/nixos/lapetus/services/whoogle.nix b/hosts/nixos/lapetus/services/whoogle.nix index 1dc32c9..f7f6ee3 100644 --- a/hosts/nixos/lapetus/services/whoogle.nix +++ b/hosts/nixos/lapetus/services/whoogle.nix @@ -27,7 +27,4 @@ in }; services.nginx.virtualHosts."search.moonythm.dev" = config.satellite.proxy port; - environment.persistence."/persist/state".directories = [ - "/var/lib/acme" - ]; }