mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-05-18 16:09:30 +00:00
Changes include: - Removing all submodules from vendor folder. - Updating sds.nimble with required depndencies. - Generating a nimble.lock file using Nimble. - Updated Nim code to reference depndencies correctly. - Added nix/deps.nix fixed output derivation that calls Nimble. - Updated nixpkgs to use 25.11 commit which provides Nimbe 0.20.1. - Disabled Nix Android builds on MacOS due to Nimble segfault. Signed-off-by: Jakub Sokołowski <jakub@status.im>
56 lines
1.4 KiB
Nix
56 lines
1.4 KiB
Nix
{ pkgs, stdenv, src, version, revision }:
|
|
|
|
stdenv.mkDerivation {
|
|
pname = "nim-sds-nimble-deps";
|
|
version = "${version}-${revision}";
|
|
|
|
inherit src;
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
jq rsync git nimble cacert moreutils
|
|
];
|
|
|
|
configurePhase = ''
|
|
export XDG_CACHE_HOME=$TMPDIR
|
|
export NIMBLE_DIR=$NIX_BUILD_TOP/nimbledir
|
|
export HOME=$TMPDIR
|
|
'';
|
|
|
|
buildPhase = ''
|
|
nimble --version
|
|
nimble --silent --localdeps setup
|
|
nimble --silent --localdeps install -y --depsOnly
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/nimbledeps
|
|
|
|
cp nimble.paths $out/nimble.paths
|
|
|
|
rsync -ra \
|
|
--prune-empty-dirs \
|
|
--include='*/' \
|
|
--include='*.json' \
|
|
--include='*.nim' \
|
|
--include='*.nimble' \
|
|
--exclude='*' \
|
|
$NIMBLE_DIR/pkgs2 $out/nimbledeps
|
|
'';
|
|
|
|
fixupPhase = ''
|
|
# Replace build path with deterministic $out.
|
|
sed "s|$NIMBLE_DIR|./nimbledeps|g" $out/nimble.paths \
|
|
| sort | sponge $out/nimble.paths
|
|
|
|
# Nimble does not maintain order of files list.
|
|
for META_FILE in $(find $out -name nimblemeta.json); do
|
|
jq '.metaData.files |= sort' $META_FILE | sponge $META_FILE
|
|
done
|
|
'';
|
|
|
|
# Make this a fixed-output derivation to allows internet access for Nimble.
|
|
outputHash = "sha256-OnirsXLj4HMVTbk+b4fcC+1K9MSMJyae6I7JO16WDno=";
|
|
outputHashAlgo = "sha256";
|
|
outputHashMode = "recursive";
|
|
}
|