summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-02-27 12:21:56 +0100
committerRory& <root@rory.gay>2024-06-27 10:21:03 +0200
commitad4fb5236b111b61e50058b4726bb2f4b8765a67 (patch)
treefd3698e4b181bb34080f9c6f9b535c5c344d8d07
parentMerge pull request #1761 from Begasus/haiku (diff)
downloadnheko-ad4fb5236b111b61e50058b4726bb2f4b8765a67.tar.xz
Nix
-rw-r--r--flake.lock79
-rw-r--r--flake.nix94
-rw-r--r--mtxclient-git.nix61
3 files changed, 234 insertions, 0 deletions
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 00000000..84ecccf2
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,79 @@
+{
+  "nodes": {
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1705309234,
+        "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "mtxclientSrc": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1708709484,
+        "narHash": "sha256-gDnashMX05xYimPAnKWR5+F/bLYKwHDlhCoQgpwVjVQ=",
+        "owner": "Nheko-reborn",
+        "repo": "mtxclient",
+        "rev": "158e991f537184ebb197341f8b77e5462de9f89d",
+        "type": "github"
+      },
+      "original": {
+        "owner": "Nheko-reborn",
+        "ref": "master",
+        "repo": "mtxclient",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1708807242,
+        "narHash": "sha256-sRTRkhMD4delO/hPxxi+XwLqPn8BuUq6nnj4JqLwOu0=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": "flake-utils",
+        "mtxclientSrc": "mtxclientSrc",
+        "nixpkgs": "nixpkgs"
+      }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 00000000..32620670
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,94 @@
+{
+  description = "Nheko Nightly";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+    flake-utils.url = "github:numtide/flake-utils";
+    mtxclientSrc = {
+      url = "github:Nheko-reborn/mtxclient/master";
+      flake = false;
+    };
+  };
+  outputs = { self, nixpkgs, flake-utils, mtxclientSrc }:
+    flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
+      let
+        pkgs = import nixpkgs {
+          inherit system;
+        };
+        lib = pkgs.lib;
+        stdenv = pkgs.stdenv;
+        voipSupport = true;
+      in rec {
+        packages.default = stdenv.mkDerivation {
+          pname = "nheko";
+          #version = "git+master";
+          version = if (self ? rev) then self.rev else "dirty";
+          src = ./.;
+
+          nativeBuildInputs = with pkgs; [
+            lmdbxx
+            cmake
+            pkg-config
+            asciidoctor
+            qt6.wrapQtAppsHook
+          ];
+
+          buildInputs = with pkgs; [
+            qt6.qtbase
+            qt6.qttools
+            qt6.qtsvg
+            qt6.qtmultimedia
+            qt6.qtimageformats
+            qt6Packages.qtkeychain
+            kdsingleapplication
+            cmark
+            coeurl
+            curl
+            libevent
+            lmdb
+            (pkgs.callPackage ./mtxclient-git.nix { inherit mtxclientSrc; })
+            nlohmann_json
+            olm
+            re2
+            spdlog
+            httplib
+          ] ++ lib.optionals voipSupport (with gst_all_1; [
+            gstreamer
+            gst-plugins-base
+            (gst-plugins-good.override { qt5Support = true; })
+            gst-plugins-bad
+            libnice
+          ]);
+
+          LC_ALL = lib.optionalString (!stdenv.isDarwin) "C.UTF-8";
+
+          cmakeFlags = [
+            "-DCOMPILE_QML=ON" # see https://github.com/Nheko-Reborn/nheko/issues/389
+            "-DCMAKE_BUILD_TYPE=Release"
+            "-DBUILD_SHARED_LIBS=OFF"
+            #Rory&
+            "-DMAN=OFF"
+            
+          ] ++ lib.optionals (!voipSupport) [
+            "-DVOIP=OFF"
+          ];
+
+
+          preFixup = lib.optionalString voipSupport ''
+            # add gstreamer plugins path to the wrapper
+            qtWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0")
+          '';
+
+          meta = with lib; {
+            description = "Desktop client for the Matrix protocol";
+            homepage = "https://github.com/Nheko-Reborn/nheko";
+            platforms = platforms.all;
+            license = licenses.gpl3Plus;
+          };
+        } ;
+        devShell = pkgs.mkShell {
+          buildInputs = [ self.packages."${system}".default.buildInputs ];
+        };
+      }
+    );
+}
diff --git a/mtxclient-git.nix b/mtxclient-git.nix
new file mode 100644
index 00000000..d2a9d6a8
--- /dev/null
+++ b/mtxclient-git.nix
@@ -0,0 +1,61 @@
+# This file was copied from NUR: https://github.com/nix-community/nur-combined/blob/master/repos/deeunderscore/pkgs/mtxclient/default.nix
+# This file is a modified version of nixpkgs/pkgs/development/libraries/mtxclient/default.nix (copied at 5c4b9be)
+
+{ lib, stdenv
+, fetchFromGitHub
+, cmake
+, pkg-config
+, openssl
+, olm
+, spdlog
+, nlohmann_json
+, libevent
+, curl
+, coeurl
+, re2
+, mtxclientSrc
+}:
+stdenv.mkDerivation {
+  pname = "mtxclient";
+  version = "git+master";
+  src = mtxclientSrc;
+
+  cmakeFlags = [
+    # Network requiring tests can't be disabled individually:
+    # https://github.com/Nheko-Reborn/mtxclient/issues/22
+    "-DBUILD_LIB_TESTS=OFF"
+    "-DBUILD_LIB_EXAMPLES=OFF"
+  ];
+
+  postPatch = ''
+    # See https://github.com/gabime/spdlog/issues/1897
+    sed -i '1a add_compile_definitions(SPDLOG_FMT_EXTERNAL)' CMakeLists.txt
+  '';
+
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
+  buildInputs = [
+    spdlog
+    nlohmann_json
+    openssl
+    olm
+    libevent
+    curl
+    coeurl
+    re2
+  ];
+
+  meta = with lib; {
+    description = "Client API library for Matrix, built on top of Boost.Asio";
+    homepage = "https://github.com/Nheko-Reborn/mtxclient";
+    license = licenses.mit;
+    maintainers = with maintainers; [ fpletz pstn ];
+    platforms = platforms.all;
+    # Should be fixable if a higher clang version is used, see:
+    # https://github.com/NixOS/nixpkgs/pull/85922#issuecomment-619287177
+    broken = stdenv.targetPlatform.isDarwin;
+  };
+}