about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2022-11-28 16:54:46 +0900
committerNguyễn Gia Phong <mcsinyx@disroot.org>2022-11-28 16:54:46 +0900
commitccb3560f85b698b7d97ec40334f99b1a514aa2cb (patch)
tree5f3aabdc575723cc8e8f041e9aec87ca398b3cbf
parent3cddfd29bcac6705fd6904844b8ea7649ee5ca2a (diff)
downloadnixos-conf-ccb3560f85b698b7d97ec40334f99b1a514aa2cb.tar.gz
Use nginx directly for Element
New element-web derivation is wrapped and breaks the IPFS hack.
-rw-r--r--element-ipfs.nix48
-rw-r--r--ipfs.nix3
-rw-r--r--matrix.nix20
3 files changed, 8 insertions, 63 deletions
diff --git a/element-ipfs.nix b/element-ipfs.nix
deleted file mode 100644
index ede1414..0000000
--- a/element-ipfs.nix
+++ /dev/null
@@ -1,48 +0,0 @@
-# Package to add Element to IPFS MFS and IPNS
-# Copyright (C) 2022  Nguyễn Gia Phong
-#
-# This file is part of loang configuration.
-#
-# Loang configuration is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published
-# by the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Loang configuration is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with loang configuration.  If not, see <https://www.gnu.org/licenses/>.
-
-{ lib, stdenv, element-web, ipfs, writeText
-, conf ? {}, ipns-key ? "element" }:
-
-let
-  element = element-web.override {
-    conf = conf;
-  };
-  ipfs-add-element = writeText "ipfs-add-element" ''
-    #!/bin/sh
-    set -xe
-    ipfs=${ipfs}/bin/ipfs
-    element=${element}
-    path=/ipfs/$($ipfs add --recursive --quieter --pin=false $element)
-    $ipfs name publish --key=${ipns-key} $path
-    $ipfs files mkdir -p $(dirname $element)
-    $ipfs files cp $path $element
-  '';
-in stdenv.mkDerivation rec {
-  pname = "element-ipfs";
-  inherit (element) version;
-
-  buildInputs = [ element ipfs ];
-
-  dontUnpack = true;
-  installPhase = ''
-    runHook preInstall
-    install -m755 -D ${ipfs-add-element} $out/bin/ipfs-add-element
-    runHook postInstall
-  '';
-}
diff --git a/ipfs.nix b/ipfs.nix
index 4a276ff..d8c19c6 100644
--- a/ipfs.nix
+++ b/ipfs.nix
@@ -49,11 +49,10 @@ in {
 
   services = {
     kubo = {
-      autoMount = true;
       dataDir = "/mnt/nas/ipfs";
       enable = true;
       enableGC = true;
-      extraConfig.GateWay = {
+      settings.GateWay = {
         NoFetch = true;
         PublicGateways."${domain}" = {
           Paths =  [ "/ipfs" "/ipns" ];
diff --git a/matrix.nix b/matrix.nix
index 24dc1e9..38b96ed 100644
--- a/matrix.nix
+++ b/matrix.nix
@@ -91,7 +91,13 @@ in {
       "than.${domain}" = {
         enableACME = true;
         forceSSL = true;
-        locations."/".proxyPass = "http://localhost:8080";
+        root = pkgs.element-web.override {
+          conf = {
+            default_server_config = client;
+            default_theme = "dark";
+            room_directory.servers = [ "loang.net" ];
+          };
+        };
       };
     };
 
@@ -107,16 +113,4 @@ in {
       package = pkgs.postgresql_14;
     };
   };
-
-  users.users.root.packages = let
-    element-ipfs = pkgs.callPackage ./element-ipfs.nix {
-      conf = {
-        default_server_config = client;
-        default_theme = "dark";
-        room_directory = {
-          servers = [ "loang.net" ];
-        };
-      };
-    };
-  in [ element-ipfs ];
 }