From eef36dd281111cf8aed923f9df52b3055bc20c68 Mon Sep 17 00:00:00 2001 From: self Date: Mon, 3 Jul 2023 00:59:31 -0700 Subject: [PATCH] fix lemmy and lemmy-ui version info --- lemmy/server.nix | 21 +++++++-------------- lemmy/ui.nix | 8 ++++++-- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/lemmy/server.nix b/lemmy/server.nix index a76ce53..9fcf594 100644 --- a/lemmy/server.nix +++ b/lemmy/server.nix @@ -1,20 +1,9 @@ -{ 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"; @@ -31,6 +20,10 @@ rustPlatform.buildRustPackage rec { 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 diff --git a/lemmy/ui.nix b/lemmy/ui.nix index db5d6dd..fe2e4ab 100644 --- a/lemmy/ui.nix +++ b/lemmy/ui.nix @@ -1,5 +1,5 @@ -{ 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; @@ -39,6 +39,10 @@ in mkYarnPackage { sha256 = pinData.uiYarnDepsSha256; }; + postPatch = '' + echo "export const VERSION = '${version}';" > "src/shared/version.ts" + ''; + yarnPreBuild = '' export npm_config_nodedir=${nodejs} ''; -- 2.44.1