From ab7a7701682074e2f074c3195fcb138305db8f0e Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 29 Nov 2022 22:02:21 +0100 Subject: Synapse on Nix works great --- cluster/staging/app/im/deploy/flake.nix | 115 +++++++- cluster/staging/app/im/deploy/im-nix.hcl | 47 ++- cluster/staging/app/im/deploy/python-packages.nix | 338 ---------------------- 3 files changed, 133 insertions(+), 367 deletions(-) delete mode 100644 cluster/staging/app/im/deploy/python-packages.nix (limited to 'cluster/staging/app') diff --git a/cluster/staging/app/im/deploy/flake.nix b/cluster/staging/app/im/deploy/flake.nix index 180e91b..e5f260d 100644 --- a/cluster/staging/app/im/deploy/flake.nix +++ b/cluster/staging/app/im/deploy/flake.nix @@ -6,34 +6,121 @@ outputs = { self, nixpkgs }: let - pkgs = import nixpkgs { - system = "x86_64-linux"; + # Generated with the help of pip2nix 0.8.0.dev1 + # See https://github.com/nix-community/pip2nix + pypkgsOverlay = pkgs: self: super: { + "pyyaml" = super.buildPythonPackage rec { + pname = "pyyaml"; + version = "5.4.1"; + src = builtins.fetchurl { + url = "https://files.pythonhosted.org/packages/a0/a4/d63f2d7597e1a4b55aa3b4d6c5b029991d3b824b5bd331af8d4ab1ed687d/PyYAML-5.4.1.tar.gz"; + sha256 = "0pm440pmpvgv5rbbnm8hk4qga5a292kvlm1bh3x2nwr8pb5p8xv0"; + }; + format = "setuptools"; + doCheck = false; + buildInputs = []; + checkInputs = []; + nativeBuildInputs = []; + propagatedBuildInputs = []; + }; + "humanize" = super.buildPythonPackage rec { + pname = "humanize"; + version = "0.5.1"; + src = builtins.fetchurl { + url = "https://files.pythonhosted.org/packages/8c/e0/e512e4ac6d091fc990bbe13f9e0378f34cf6eecd1c6c268c9e598dcf5bb9/humanize-0.5.1.tar.gz"; + sha256 = "06dvhm3k8lf2rayn1gxbd46y0fy1db26m3h9vrq7rb1ib08mfgx4"; + }; + format = "setuptools"; + doCheck = false; + buildInputs = []; + checkInputs = []; + nativeBuildInputs = []; + propagatedBuildInputs = []; + }; + "synapse-s3-storage-provider" = super.buildPythonPackage rec { + pname = "synapse-s3-storage-provider"; + version = "1.1.2"; + src = builtins.fetchurl { + url = "https://github.com/matrix-org/synapse-s3-storage-provider/archive/refs/tags/v1.1.2.zip"; + sha256 = "0xd5icfvnvdd3qadlsmqvj2qjm6rsvk1vbpiycdc7ypr9dp7x9z8"; + }; + format = "setuptools"; + doCheck = false; + buildInputs = []; + checkInputs = []; + nativeBuildInputs = [ + pkgs."unzip" + ]; + propagatedBuildInputs = [ + self."pyyaml" + self."twisted" + self."boto3" + self."botocore" + self."humanize" + self."psycopg2" + self."tqdm" + ]; + }; }; - pypkgsOverlay = import ./python-packages.nix { - inherit pkgs; - fetchurl = builtins.fetchurl; - fetchgit = pkgs.fetchgit; - fetchhg = pkgs.fetchhg; - }; - pkgs2 = import nixpkgs { + pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (self: super: { python3 = super.python3.override { self = self.python3; - packageOverrides = pypkgsOverlay; + packageOverrides = (pypkgsOverlay super); }; }) ]; }; - synapseWithS3 = pkgs2.matrix-synapse.overridePythonAttrs (old: rec { + + synapse = pkgs.matrix-synapse.overridePythonAttrs (old: rec { propagatedBuildInputs = old.propagatedBuildInputs ++ [ - pkgs2.python3.pkgs.synapse-s3-storage-provider + pkgs.python3.pkgs.synapse-s3-storage-provider ]; }); + + s3_provider = pkgs.python3.withPackages(ps: [ps.synapse-s3-storage-provider]); + + matrix_s3_async = pkgs.writeScriptBin "matrix-s3-async" '' +#!${pkgs.bash}/bin/bash + +${pkgs.coreutils}/bin/cat > database.yaml < database.yaml <