Skip to content

Commit 1558458

Browse files
committed
atomic-server: refactor to rebuild from github source
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.
1 parent 5bb89ef commit 1558458

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

pkgs/by-name/atomic-server/package.nix

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
lib,
3-
fetchCrate,
3+
fetchFromGitHub,
44
rustPlatform,
5+
atomic-browser,
56
}: let
67
inherit
78
(lib)
@@ -12,12 +13,22 @@ in
1213
pname = "atomic-server";
1314
version = "0.37.0";
1415

15-
src = fetchCrate {
16-
inherit pname version;
17-
hash = "sha256-/OKYac0HA9EWDQ5qNyMPITN5iUdLM9SAVmOm6PVIFOk=";
16+
src = fetchFromGitHub {
17+
owner = "atomicdata-dev";
18+
repo = pname;
19+
rev = "v${version}";
20+
hash = "sha256-+Lk2MvkTj+B+G6cNbWAbPrN5ECiyMJ4HSiiLzBLd74g=";
1821
};
1922

20-
cargoHash = "sha256-LwSyK/7EEoTf1x7KGtebPxYTqH3SCjXGONNMxcmdEv0=";
23+
cargoHash = "sha256-cSv1XnuzL5PxVOTAUiyiQsMHSRUMaFDkW2/4Bt75G9o=";
24+
25+
# server/assets_tmp is the directory atomic-server's build will check for
26+
# compiled frontend assets to decide whether to rebuild or not
27+
# https://github.com/atomicdata-dev/atomic-server/blob/ba3c5959867a563d4da00bb23fd13e45e69dc5d7/server/build.rs#L22-L37
28+
postUnpack = ''
29+
mkdir -p source/server/assets_tmp
30+
cp -r ${atomic-browser}/* source/server/assets_tmp
31+
'';
2132

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

0 commit comments

Comments
 (0)