Skip to content

Commit

Permalink
atomic-server: refactor to rebuild from github source
Browse files Browse the repository at this point in the history
This refactor builds atomic-server using the separately packaged
atomic-browser and then the github source. Not only is this more
reflective of the real build process used, but it is helpful when trying
to debug atomic-server by building a fork with additional logging, which
we did while working on #220

Previously we were building atomic-server from the published crate,
which is usually "from source". But in this case that meant only the
rust source, and separately built web assets were packaged into the
crate. This can be verified by running
`curl -L 'https://crates.io/api/v1/crates/atomic-server/0.37.0/download' | tar -tv`
and checking for the `assets_tmp` directory.
  • Loading branch information
albertchae authored and fricklerhandwerk committed Aug 14, 2024
1 parent 3a2d6fc commit a70e44b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pkgs/by-name/atomic-server/package.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
lib,
fetchCrate,
fetchFromGitHub,
rustPlatform,
atomic-browser,
}: let
inherit
(lib)
Expand All @@ -12,12 +13,22 @@ in
pname = "atomic-server";
version = "0.37.0";

src = fetchCrate {
inherit pname version;
hash = "sha256-/OKYac0HA9EWDQ5qNyMPITN5iUdLM9SAVmOm6PVIFOk=";
src = fetchFromGitHub {
owner = "atomicdata-dev";
repo = pname;
rev = "v${version}";
hash = "sha256-+Lk2MvkTj+B+G6cNbWAbPrN5ECiyMJ4HSiiLzBLd74g=";
};

cargoHash = "sha256-LwSyK/7EEoTf1x7KGtebPxYTqH3SCjXGONNMxcmdEv0=";
cargoHash = "sha256-cSv1XnuzL5PxVOTAUiyiQsMHSRUMaFDkW2/4Bt75G9o=";

# server/assets_tmp is the directory atomic-server's build will check for
# compiled frontend assets to decide whether to rebuild or not
# https://github.com/atomicdata-dev/atomic-server/blob/ba3c5959867a563d4da00bb23fd13e45e69dc5d7/server/build.rs#L22-L37
postUnpack = ''
mkdir -p source/server/assets_tmp
cp -r ${atomic-browser}/* source/server/assets_tmp
'';

doCheck = false; # TODO(jl): broken upstream

Expand Down

0 comments on commit a70e44b

Please sign in to comment.