-{ lib
-, stdenv
-, rustPlatform
-, fetchFromGitHub
-, openssl
-, postgresql
-, libiconv
-, Security
-, protobuf
-, rustfmt
-, nixosTests
-}:
+{ lib, stdenv, rustPlatform, fetchFromGitHub, openssl, postgresql, libiconv
+, Security, protobuf, rustfmt, nixosTests }:
let
pinData = lib.importJSON ./pin.json;
version = pinData.version;
-in
-rustPlatform.buildRustPackage rec {
+in rustPlatform.buildRustPackage rec {
inherit version;
pname = "lemmy-server";
buildInputs = [ postgresql ]
++ lib.optionals stdenv.isDarwin [ libiconv Security ];
+ postPatch = ''
+ echo "pub const VERSION: &str = \"${version}\";" > "crates/utils/src/version.rs"
+ '';
+
# Using OPENSSL_NO_VENDOR is not an option on darwin
# As of version 0.10.35 rust-openssl looks for openssl on darwin
# with a hardcoded path to /usr/lib/libssl.x.x.x.dylib
-{ lib, mkYarnPackage, libsass, nodejs, python3, pkg-config
-, fetchFromGitHub, fetchYarnDeps, nixosTests }:
+{ lib, mkYarnPackage, libsass, nodejs, python3, pkg-config, fetchFromGitHub
+, fetchYarnDeps, nixosTests }:
let
pinData = lib.importJSON ./pin.json;
sha256 = pinData.uiYarnDepsSha256;
};
+ postPatch = ''
+ echo "export const VERSION = '${version}';" > "src/shared/version.ts"
+ '';
+
yarnPreBuild = ''
export npm_config_nodedir=${nodejs}
'';